From bartosz.markowski at tieto.com  Thu Jan  2 08:38:33 2014
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Thu,  2 Jan 2014 14:38:33 +0100
Subject: [PATCH] ath10k: track number of existing peers
Message-ID: <1388669913-29031-1-git-send-email-bartosz.markowski@tieto.com>

To not exceed number of allowed clients (AP mode), make sure to
check how many of them are already on the peers list.

10.X firmware support up to 127 peers, non-AP centric firmwares 16.

Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |    3 +++
 drivers/net/wireless/ath/ath10k/hw.h   |    1 +
 drivers/net/wireless/ath/ath10k/mac.c  |   28 +++++++++++++++++++++++++---
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 035cbf6..9d8fc29 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -432,6 +432,9 @@ struct ath10k {
 	struct list_head peers;
 	wait_queue_head_t peer_mapping_wq;
 
+	/* number of created peers; protected by data_lock */
+	int num_peers;
+
 	struct work_struct offchan_tx_work;
 	struct sk_buff_head offchan_tx_queue;
 	struct completion offchan_tx_completed;
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 9535eaa..f1505a2 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -115,6 +115,7 @@ enum ath10k_mcast2ucast_mode {
 #define TARGET_10X_MAC_AGGR_DELIM		0
 #define TARGET_10X_AST_SKID_LIMIT		16
 #define TARGET_10X_NUM_PEERS			(128 + (TARGET_10X_NUM_VDEVS))
+#define TARGET_10X_NUM_PEERS_MAX		128
 #define TARGET_10X_NUM_OFFLOAD_PEERS		0
 #define TARGET_10X_NUM_OFFLOAD_REORDER_BUFS	0
 #define TARGET_10X_NUM_PEER_KEYS		2
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 5b45f3a..9ef3230 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -332,6 +332,9 @@ static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr)
 		ath10k_warn("Failed to wait for created wmi peer: %i\n", ret);
 		return ret;
 	}
+	spin_lock_bh(&ar->data_lock);
+	ar->num_peers++;
+	spin_unlock_bh(&ar->data_lock);
 
 	return 0;
 }
@@ -377,6 +380,10 @@ static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr)
 	if (ret)
 		return ret;
 
+	spin_lock_bh(&ar->data_lock);
+	ar->num_peers--;
+	spin_unlock_bh(&ar->data_lock);
+
 	return 0;
 }
 
@@ -396,6 +403,7 @@ static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id)
 
 		list_del(&peer->list);
 		kfree(peer);
+		ar->num_peers--;
 	}
 	spin_unlock_bh(&ar->data_lock);
 }
@@ -411,6 +419,7 @@ static void ath10k_peer_cleanup_all(struct ath10k *ar)
 		list_del(&peer->list);
 		kfree(peer);
 	}
+	ar->num_peers = 0;
 	spin_unlock_bh(&ar->data_lock);
 }
 
@@ -2842,6 +2851,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,
 {
 	struct ath10k *ar = hw->priv;
 	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+	int max_num_peers;
 	int ret = 0;
 
 	mutex_lock(&ar->conf_mutex);
@@ -2852,9 +2862,21 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,
 		/*
 		 * New station addition.
 		 */
+		if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features))
+			max_num_peers = TARGET_10X_NUM_PEERS_MAX - 1;
+		else
+			max_num_peers = TARGET_NUM_PEERS;
+
+		if (ar->num_peers >= max_num_peers) {
+			ath10k_warn("Number of peers exceeded: peers number %d (max peers %d)\n",
+				    ar->num_peers, max_num_peers);
+			ret = -ENOBUFS;
+			goto exit;
+		}
+
 		ath10k_dbg(ATH10K_DBG_MAC,
-			   "mac vdev %d peer create %pM (new sta)\n",
-			   arvif->vdev_id, sta->addr);
+			   "mac vdev %d peer create %pM (new sta) num_peers %d\n",
+			   arvif->vdev_id, sta->addr, ar->num_peers);
 
 		ret = ath10k_peer_create(ar, arvif->vdev_id, sta->addr);
 		if (ret)
@@ -2904,7 +2926,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,
 			ath10k_warn("Failed to disassociate station: %pM\n",
 				    sta->addr);
 	}
-
+exit:
 	mutex_unlock(&ar->conf_mutex);
 	return ret;
 }
-- 
1.7.10



From yeohchunyeow at gmail.com  Fri Jan  3 04:43:27 2014
From: yeohchunyeow at gmail.com (Chun-Yeow Yeoh)
Date: Fri,  3 Jan 2014 17:43:27 +0800
Subject: [PATCH] ath10k: fix the MAC address of peer statistic
Message-ID: <1388742207-15694-1-git-send-email-yeohchunyeow@gmail.com>

Fix the MAC address of wmi_peer_stats so that it is
printed correctly. This is tested and verified using
firmware version 999.999.0.636.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow at gmail.com>
---
 drivers/net/wireless/ath/ath10k/debug.c |    3 +++
 drivers/net/wireless/ath/ath10k/wmi.h   |   14 +++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 6bdfad3..eec3439 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -242,6 +242,9 @@ void ath10k_debug_read_target_stats(struct ath10k *ar,
 		}
 	}
 
+	/* The first peer is self MAC address, ignore this */
+	num_peer_stats--;
+
 	if (num_peer_stats) {
 		struct wmi_peer_stats *peer_stats;
 		struct ath10k_peer_stat *s;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 0087d69..106a23e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -200,12 +200,12 @@ struct wmi_mac_addr {
 
 /* macro to convert MAC address from WMI word format to char array */
 #define WMI_MAC_ADDR_TO_CHAR_ARRAY(pwmi_mac_addr, c_macaddr) do { \
-	(c_macaddr)[0] =  ((pwmi_mac_addr)->word0) & 0xff; \
-	(c_macaddr)[1] = (((pwmi_mac_addr)->word0) >> 8) & 0xff; \
-	(c_macaddr)[2] = (((pwmi_mac_addr)->word0) >> 16) & 0xff; \
-	(c_macaddr)[3] = (((pwmi_mac_addr)->word0) >> 24) & 0xff; \
-	(c_macaddr)[4] =  ((pwmi_mac_addr)->word1) & 0xff; \
-	(c_macaddr)[5] = (((pwmi_mac_addr)->word1) >> 8) & 0xff; \
+	(c_macaddr)[0] = (((pwmi_mac_addr)->word0) >> 24) & 0xff; \
+	(c_macaddr)[1] = (((pwmi_mac_addr)->word0) >> 16) & 0xff; \
+	(c_macaddr)[2] = (((pwmi_mac_addr)->word0) >> 8) & 0xff; \
+	(c_macaddr)[3] =  ((pwmi_mac_addr)->word0) & 0xff; \
+	(c_macaddr)[4] = (((pwmi_mac_addr)->word1) >> 24) & 0xff; \
+	(c_macaddr)[5] = (((pwmi_mac_addr)->word1) >> 16) & 0xff; \
 	} while (0)
 
 struct wmi_cmd_map {
@@ -2820,9 +2820,9 @@ struct wmi_vdev_stats {
  * TODO: add more stats
  */
 struct wmi_peer_stats {
+	__le32 peer_tx_rate;	/* TBA */
 	struct wmi_mac_addr peer_macaddr;
 	__le32 peer_rssi;
-	__le32 peer_tx_rate;
 } __packed;
 
 struct wmi_vdev_create_cmd {
-- 
1.7.9.5



From kvalo at qca.qualcomm.com  Fri Jan  3 05:59:13 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 03 Jan 2014 12:59:13 +0200
Subject: [PATCH 0/3] ath10k: firmware dbglog and debug print events
Message-ID: <20140103105718.13474.70922.stgit@potku.adurom.net>

Here are two new interfaces, dbglog and debug print events, to help with
firmware debugging on ath10k. Please review.

---

Kalle Valo (3):
      ath10k: handle WMI debug print events
      ath10k: add trace event for WMI_DEBUG_MESG_EVENTID
      ath10k: add debugfs file to control firmware dbglog


 drivers/net/wireless/ath/ath10k/core.h  |    2 +
 drivers/net/wireless/ath/ath10k/debug.c |   66 ++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/trace.h |   21 ++++++++
 drivers/net/wireless/ath/ath10k/wmi.c   |   79 +++++++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath10k/wmi.h   |   49 +++++++++++++++++++
 5 files changed, 213 insertions(+), 4 deletions(-)



From kvalo at qca.qualcomm.com  Fri Jan  3 05:59:20 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 03 Jan 2014 12:59:20 +0200
Subject: [PATCH 1/3] ath10k: handle WMI debug print events
In-Reply-To: <20140103105718.13474.70922.stgit@potku.adurom.net>
References: <20140103105718.13474.70922.stgit@potku.adurom.net>
Message-ID: <20140103105920.13474.65657.stgit@potku.adurom.net>

Firmware can send simple ascii strings as debug messages using
WMI_DEBUG_PRINT_EVENTID, print those with ATH10K_DBG_WMI log level.

Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |   33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 3ec6c9a..f992570 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -16,6 +16,7 @@
  */
 
 #include <linux/skbuff.h>
+#include <linux/ctype.h>
 
 #include "core.h"
 #include "htc.h"
@@ -1676,9 +1677,37 @@ static void ath10k_wmi_event_profile_match(struct ath10k *ar,
 }
 
 static void ath10k_wmi_event_debug_print(struct ath10k *ar,
-				  struct sk_buff *skb)
+					 struct sk_buff *skb)
 {
-	ath10k_dbg(ATH10K_DBG_WMI, "WMI_DEBUG_PRINT_EVENTID\n");
+	char buf[101], c;
+	int i;
+
+	for (i = 0; i < sizeof(buf) - 1; i++) {
+		if (i >= skb->len)
+			break;
+
+		c = skb->data[i];
+
+		if (c == '\0')
+			break;
+
+		if (isascii(c) && isprint(c))
+			buf[i] = c;
+		else
+			buf[i] = '.';
+	}
+
+	if (i == sizeof(buf) - 1)
+		ath10k_warn("wmi debug print truncated: %d\n", skb->len);
+
+	/* for some reason the debug prints end with \n, remove that */
+	if (skb->data[i - 1] == '\n')
+		i--;
+
+	/* the last byte is always reserved for the null character */
+	buf[i] = '\0';
+
+	ath10k_dbg(ATH10K_DBG_WMI, "wmi event debug print '%s'\n", buf);
 }
 
 static void ath10k_wmi_event_pdev_qvit(struct ath10k *ar, struct sk_buff *skb)



From kvalo at qca.qualcomm.com  Fri Jan  3 05:59:26 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 03 Jan 2014 12:59:26 +0200
Subject: [PATCH 2/3] ath10k: add trace event for WMI_DEBUG_MESG_EVENTID
In-Reply-To: <20140103105718.13474.70922.stgit@potku.adurom.net>
References: <20140103105718.13474.70922.stgit@potku.adurom.net>
Message-ID: <20140103105926.13474.5152.stgit@potku.adurom.net>

Send firmware WMI debug logs to user space for further processing.

Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/trace.h |   21 +++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c   |    9 +++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/trace.h b/drivers/net/wireless/ath/ath10k/trace.h
index 90817dd..4eb2ecb 100644
--- a/drivers/net/wireless/ath/ath10k/trace.h
+++ b/drivers/net/wireless/ath/ath10k/trace.h
@@ -182,6 +182,27 @@ TRACE_EVENT(ath10k_htt_stats,
 	)
 );
 
+TRACE_EVENT(ath10k_wmi_dbglog,
+	TP_PROTO(void *buf, size_t buf_len),
+
+	TP_ARGS(buf, buf_len),
+
+	TP_STRUCT__entry(
+		__field(size_t, buf_len)
+		__dynamic_array(u8, buf, buf_len)
+	),
+
+	TP_fast_assign(
+		__entry->buf_len = buf_len;
+		memcpy(__get_dynamic_array(buf), buf, buf_len);
+	),
+
+	TP_printk(
+		"len %zu",
+		__entry->buf_len
+	)
+);
+
 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
 
 /* we don't want to use include/trace/events */
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index f992570..4e043bb 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1071,9 +1071,14 @@ static void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb)
 	ath10k_dbg(ATH10K_DBG_WMI, "WMI_ECHO_EVENTID\n");
 }
 
-static void ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb)
+static int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb)
 {
-	ath10k_dbg(ATH10K_DBG_WMI, "WMI_DEBUG_MESG_EVENTID\n");
+	ath10k_dbg(ATH10K_DBG_WMI, "wmi event debug mesg len %d\n",
+		   skb->len);
+
+	trace_ath10k_wmi_dbglog(skb->data, skb->len);
+
+	return 0;
 }
 
 static void ath10k_wmi_event_update_stats(struct ath10k *ar,



From kvalo at qca.qualcomm.com  Fri Jan  3 05:59:31 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 03 Jan 2014 12:59:31 +0200
Subject: [PATCH 3/3] ath10k: add debugfs file to control firmware dbglog
In-Reply-To: <20140103105718.13474.70922.stgit@potku.adurom.net>
References: <20140103105718.13474.70922.stgit@potku.adurom.net>
Message-ID: <20140103105931.13474.73974.stgit@potku.adurom.net>

Firmware dbglogs can be now enabled through fw_dbglog file. To enable all
possible log messages run:

echo 0xffffffff > /sys/kernel/debug/ieee80211/phy0/ath10k/fw_dbglog

And to put back firmare defaults use 0x0:

echo 0x0 > /sys/kernel/debug/ieee80211/phy0/ath10k/fw_dbglog

Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.h  |    2 +
 drivers/net/wireless/ath/ath10k/debug.c |   66 +++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c   |   37 +++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h   |   49 +++++++++++++++++++++++
 4 files changed, 154 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 035cbf6..a577067 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -272,6 +272,8 @@ struct ath10k_debug {
 	struct delayed_work htt_stats_dwork;
 	struct ath10k_dfs_stats dfs_stats;
 	struct ath_dfs_pool_stats dfs_pool_stats;
+
+	u32 fw_dbglog_mask;
 };
 
 enum ath10k_state {
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 6bdfad3..6debd28 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -614,6 +614,61 @@ static const struct file_operations fops_htt_stats_mask = {
 	.llseek = default_llseek,
 };
 
+static ssize_t ath10k_read_fw_dbglog(struct file *file,
+					    char __user *user_buf,
+					    size_t count, loff_t *ppos)
+{
+	struct ath10k *ar = file->private_data;
+	unsigned int len;
+	char buf[32];
+
+	len = scnprintf(buf, sizeof(buf), "0x%08x\n",
+			ar->debug.fw_dbglog_mask);
+
+	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t ath10k_write_fw_dbglog(struct file *file,
+				      const char __user *user_buf,
+				      size_t count, loff_t *ppos)
+{
+	struct ath10k *ar = file->private_data;
+	unsigned long mask;
+	int ret;
+
+	ret = kstrtoul_from_user(user_buf, count, 0, &mask);
+	if (ret)
+		return ret;
+
+	mutex_lock(&ar->conf_mutex);
+
+	ar->debug.fw_dbglog_mask = mask;
+
+	if (ar->state == ATH10K_STATE_ON) {
+		ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask);
+		if (ret) {
+			ath10k_warn("dbglog cfg failed from debugfs: %d\n",
+				    ret);
+			goto exit;
+		}
+	}
+
+	ret = count;
+
+exit:
+	mutex_unlock(&ar->conf_mutex);
+
+	return ret;
+}
+
+static const struct file_operations fops_fw_dbglog = {
+	.read = ath10k_read_fw_dbglog,
+	.write = ath10k_write_fw_dbglog,
+	.open = simple_open,
+	.owner = THIS_MODULE,
+	.llseek = default_llseek,
+};
+
 int ath10k_debug_start(struct ath10k *ar)
 {
 	int ret;
@@ -625,6 +680,14 @@ int ath10k_debug_start(struct ath10k *ar)
 		/* continue normally anyway, this isn't serious */
 		ath10k_warn("failed to start htt stats workqueue: %d\n", ret);
 
+	if (ar->debug.fw_dbglog_mask) {
+		ret = ath10k_wmi_dbglog_cfg(ar, ar->debug.fw_dbglog_mask);
+		if (ret)
+			/* not serious */
+			ath10k_warn("failed to enable dbglog during start: %d",
+				    ret);
+	}
+
 	return 0;
 }
 
@@ -747,6 +810,9 @@ int ath10k_debug_create(struct ath10k *ar)
 	debugfs_create_file("htt_stats_mask", S_IRUSR, ar->debug.debugfs_phy,
 			    ar, &fops_htt_stats_mask);
 
+	debugfs_create_file("fw_dbglog", S_IRUSR, ar->debug.debugfs_phy,
+			    ar, &fops_fw_dbglog);
+
 	if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) {
 		debugfs_create_file("dfs_simulate_radar", S_IWUSR,
 				    ar->debug.debugfs_phy, ar,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 4e043bb..712a606 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3502,3 +3502,40 @@ int ath10k_wmi_force_fw_hang(struct ath10k *ar,
 		   type, delay_ms);
 	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid);
 }
+
+int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable)
+{
+	struct wmi_dbglog_cfg_cmd *cmd;
+	struct sk_buff *skb;
+	u32 cfg;
+
+	skb = ath10k_wmi_alloc_skb(sizeof(*cmd));
+	if (!skb)
+		return -ENOMEM;
+
+	cmd = (struct wmi_dbglog_cfg_cmd *)skb->data;
+
+	if (module_enable) {
+		cfg = SM(ATH10K_DBGLOG_LEVEL_VERBOSE,
+			 ATH10K_DBGLOG_CFG_LOG_LVL);
+	} else {
+		/* set back defaults, all modules with WARN level */
+		cfg = SM(ATH10K_DBGLOG_LEVEL_WARN,
+			 ATH10K_DBGLOG_CFG_LOG_LVL);
+		module_enable = ~0;
+	}
+
+	cmd->module_enable = __cpu_to_le32(module_enable);
+	cmd->module_valid = __cpu_to_le32(~0);
+	cmd->config_enable = __cpu_to_le32(cfg);
+	cmd->config_valid = __cpu_to_le32(ATH10K_DBGLOG_CFG_LOG_LVL_MASK);
+
+	ath10k_dbg(ATH10K_DBG_WMI,
+		   "wmi dbglog cfg modules %08x %08x config %08x %08x\n",
+		   __le32_to_cpu(cmd->module_enable),
+		   __le32_to_cpu(cmd->module_valid),
+		   __le32_to_cpu(cmd->config_enable),
+		   __le32_to_cpu(cmd->config_valid));
+
+	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->dbglog_cfg_cmdid);
+}
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 0087d69..4aa1489 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -4090,6 +4090,54 @@ struct wmi_force_fw_hang_cmd {
 	__le32 delay_ms;
 } __packed;
 
+enum ath10k_dbglog_level {
+	ATH10K_DBGLOG_LEVEL_VERBOSE = 0,
+	ATH10K_DBGLOG_LEVEL_INFO = 1,
+	ATH10K_DBGLOG_LEVEL_WARN = 2,
+	ATH10K_DBGLOG_LEVEL_ERR = 3,
+};
+
+/* VAP ids to enable dbglog */
+#define ATH10K_DBGLOG_CFG_VAP_LOG_LSB		0
+#define ATH10K_DBGLOG_CFG_VAP_LOG_MASK		0x0000ffff
+
+/* to enable dbglog in the firmware */
+#define ATH10K_DBGLOG_CFG_REPORTING_ENABLE_LSB	16
+#define ATH10K_DBGLOG_CFG_REPORTING_ENABLE_MASK	0x00010000
+
+/* timestamp resolution */
+#define ATH10K_DBGLOG_CFG_RESOLUTION_LSB	17
+#define ATH10K_DBGLOG_CFG_RESOLUTION_MASK	0x000E0000
+
+/* number of queued messages before sending them to the host */
+#define ATH10K_DBGLOG_CFG_REPORT_SIZE_LSB	20
+#define ATH10K_DBGLOG_CFG_REPORT_SIZE_MASK	0x0ff00000
+
+/*
+ * Log levels to enable. This defines the minimum level to enable, this is
+ * not a bitmask. See enum ath10k_dbglog_level for the values.
+ */
+#define ATH10K_DBGLOG_CFG_LOG_LVL_LSB		28
+#define ATH10K_DBGLOG_CFG_LOG_LVL_MASK		0x70000000
+
+/*
+ * Note: this is a cleaned up version of a struct firmware uses. For
+ * example, config_valid was hidden inside an array.
+ */
+struct wmi_dbglog_cfg_cmd {
+	/* bitmask to hold mod id config*/
+	__le32 module_enable;
+
+	/* see ATH10K_DBGLOG_CFG_ */
+	__le32 config_enable;
+
+	/* mask of module id bits to be changed */
+	__le32 module_valid;
+
+	/* mask of config bits to be changed, see ATH10K_DBGLOG_CFG_ */
+	__le32 config_valid;
+} __packed;
+
 #define ATH10K_RTS_MAX		2347
 #define ATH10K_FRAGMT_THRESHOLD_MIN	540
 #define ATH10K_FRAGMT_THRESHOLD_MAX	2346
@@ -4167,5 +4215,6 @@ int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id);
 int ath10k_wmi_force_fw_hang(struct ath10k *ar,
 			     enum wmi_force_fw_hang_type type, u32 delay_ms);
 int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb);
+int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable);
 
 #endif /* _WMI_H_ */



From yeohchunyeow at gmail.com  Mon Jan  6 03:57:27 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Mon, 6 Jan 2014 16:57:27 +0800
Subject: WMI Parameters
Message-ID: <CAEFj987vWzG3SfDmpoURq_XDpMxAKeik3ogT8snsnThWrf37-g@mail.gmail.com>

Hi, all

I would like to change the beacon Tx Rate. Is this possible?

I have tried to change multicast_rate, mgmt_tx_rate, bcast_data_rate
or mcast_data_rate in struct wmi_vdev_param_map. But no luck, it won't
work.

Can someone advice.

Thanks

Regards,
Chun-Yeow


From moon.linux at yahoo.com  Tue Jan  7 05:35:41 2014
From: moon.linux at yahoo.com (Anand Moon)
Date: Tue, 7 Jan 2014 02:35:41 -0800 (PST)
Subject: 5gz 802.11n and 5ghz 802.11ac packet caputure.
Message-ID: <1389090941.99903.YahooMailNeo@web122306.mail.ne1.yahoo.com>

?
Hi All,

Could some one share the basic packet capture for 5gz 802.11n and 5ghz 802.11ac.
I just want to understand the difference in packet structure and packet details.

This is just for study purpose. 

-Anand Moon

-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.14 (GNU/Linux)
jA0EAwMCYq3dHqTzwcVgyRxC1j+oLxS8Yw92EIeKln+x3eAWzd7mM/pUluRo
=0RYk
-----END PGP MESSAGE-----



From janusz.dziedzic at tieto.com  Wed Jan  8 03:08:33 2014
From: janusz.dziedzic at tieto.com (Janusz Dziedzic)
Date: Wed,  8 Jan 2014 09:08:33 +0100
Subject: [PATCH v3] ath10k: add set_bitrate_mask callback
Message-ID: <1389168513-5606-1-git-send-email-janusz.dziedzic@tieto.com>

Add set_bitrate_mask callback. Currently
ath10k HW is limited to handle only single
fixed rate setting or limit number of used
spatial streams.

Example:
iw wlanX set bitrates legacy-5 ht-mcs-5 vht-mcs-5 2:9
will setup VHT, nss=2, mcs=9

iw wlanX set bitrates legacy-5 18 ht-mcs-5 vht-mcs-5
will setup legacy, 18Mbps

iw wlanX set bitrates legacy-5 ht-mcs-5 3 vht-mcs-5
will setup HT, nss=1, mcs=3

iw wlanX set bitrate legacy-5 ht-mcs-5 vht-mcs-5 1:0-9
will setup nss=1

iw wlanX set bitrate legacy-5 ht-mcs-5 vht-mcs-5 1:0-9 2:0-9
will setup nss=2

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
Depends on, nl80211: add VHT support for set_bitrate_mask
iw setup example base on, iw: add VHT MCS/NSS set support to set bitrates

*V2 - fix sparse error, fix documentation
*V3 - fix smatch errors

 drivers/net/wireless/ath/ath10k/core.h |    3 +
 drivers/net/wireless/ath/ath10k/mac.c  |  302 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h  |   12 ++
 3 files changed, 317 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 79726e0..3817e32 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -253,6 +253,9 @@ struct ath10k_vif {
 			u8 bssid[ETH_ALEN];
 		} ibss;
 	} u;
+
+	u8 fixed_rate;
+	u8 fixed_nss;
 };
 
 struct ath10k_vif_iter {
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index ce9ef349..fe9369a 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3310,6 +3310,307 @@ exit:
 	return ret;
 }
 
+/* Helper table for legacy fixed_rate/bitrate_mask */
+static const u8 cck_ofdm_rate[] = {
+	/* CCK */
+	3, /* 1Mbps */
+	2, /* 2Mbps */
+	1, /* 5.5Mbps */
+	0, /* 11Mbps */
+	/* OFDM */
+	3, /* 6Mbps */
+	7, /* 9Mbps */
+	2, /* 12Mbps */
+	6, /* 18Mbps */
+	1, /* 24Mbps */
+	5, /* 36Mbps */
+	0, /* 48Mbps */
+	4, /* 54Mbps */
+};
+
+/* Check if only one bit set */
+static int ath10k_check_single_mask(u32 mask)
+{
+	int bit;
+
+	bit = ffs(mask);
+	if (!bit)
+		return 0;
+
+	mask &= ~BIT(bit - 1);
+	if (mask)
+		return 2;
+
+	return 1;
+}
+
+static bool
+ath10k_default_bitrate_mask(struct ath10k *ar,
+			    enum ieee80211_band band,
+			    const struct cfg80211_bitrate_mask *mask)
+{
+	u32 legacy = 0x00ff;
+	u8 ht = 0xff, i;
+	u16 vht = 0x3ff;
+
+	switch (band) {
+	case IEEE80211_BAND_2GHZ:
+		legacy = 0x00fff;
+		vht = 0;
+		break;
+	case IEEE80211_BAND_5GHZ:
+		break;
+	default:
+		return false;
+	}
+
+	if (mask->control[band].legacy != legacy)
+		return false;
+
+	for (i = 0; i < ar->num_rf_chains; i++)
+		if (mask->control[band].ht_mcs[i] != ht)
+			return false;
+
+	for (i = 0; i < ar->num_rf_chains; i++)
+		if (mask->control[band].vht_mcs[i] != vht)
+			return false;
+
+	return true;
+}
+
+static bool
+ath10k_bitrate_mask_nss(const struct cfg80211_bitrate_mask *mask,
+			enum ieee80211_band band,
+			u8 *fixed_nss)
+{
+	int ht_nss = 0, vht_nss = 0, i;
+
+	/* check legacy */
+	if (ath10k_check_single_mask(mask->control[band].legacy))
+		return false;
+
+	/* check HT */
+	for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) {
+		if (mask->control[band].ht_mcs[i] == 0xff)
+			continue;
+		else if (mask->control[band].ht_mcs[i] == 0x00)
+			break;
+		else
+			return false;
+	}
+
+	ht_nss = i;
+
+	/* check VHT */
+	for (i = 0; i < NL80211_VHT_NSS_MAX; i++) {
+		if (mask->control[band].vht_mcs[i] == 0x03ff)
+			continue;
+		else if (mask->control[band].vht_mcs[i] == 0x0000)
+			break;
+		else
+			return false;
+	}
+
+	vht_nss = i;
+
+	if (ht_nss > 0 && vht_nss > 0)
+		return false;
+
+	if (ht_nss)
+		*fixed_nss = ht_nss;
+	else if (vht_nss)
+		*fixed_nss = vht_nss;
+	else
+		return false;
+
+	return true;
+}
+
+static bool
+ath10k_bitrate_mask_correct(const struct cfg80211_bitrate_mask *mask,
+			    enum ieee80211_band band,
+			    enum wmi_rate_preamble *preamble)
+{
+	int legacy = 0, ht = 0, vht = 0, i;
+
+	*preamble = WMI_RATE_PREAMBLE_OFDM;
+
+	/* check legacy */
+	legacy = ath10k_check_single_mask(mask->control[band].legacy);
+	if (legacy > 1)
+		return false;
+
+	/* check HT */
+	for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++)
+		ht += ath10k_check_single_mask(mask->control[band].ht_mcs[i]);
+	if (ht > 1)
+		return false;
+
+	/* check VHT */
+	for (i = 0; i < NL80211_VHT_NSS_MAX; i++)
+		vht += ath10k_check_single_mask(mask->control[band].vht_mcs[i]);
+	if (vht > 1)
+		return false;
+
+	/* Currently we support only one fixed_rate */
+	if ((legacy + ht + vht) != 1)
+		return false;
+
+	if (ht)
+		*preamble = WMI_RATE_PREAMBLE_HT;
+	else if (vht)
+		*preamble = WMI_RATE_PREAMBLE_VHT;
+
+	return true;
+}
+
+static bool
+ath10k_bitrate_mask_rate(const struct cfg80211_bitrate_mask *mask,
+			 enum ieee80211_band band,
+			 u8 *fixed_rate,
+			 u8 *fixed_nss)
+{
+	u8 rate = 0, pream = 0, nss = 0, i;
+	enum wmi_rate_preamble preamble;
+
+	/* Check if single rate correct */
+	if (!ath10k_bitrate_mask_correct(mask, band, &preamble))
+		return false;
+
+	pream = preamble;
+
+	switch (preamble) {
+	case WMI_RATE_PREAMBLE_CCK:
+	case WMI_RATE_PREAMBLE_OFDM:
+		i = ffs(mask->control[band].legacy) - 1;
+
+		if (band == IEEE80211_BAND_2GHZ && i < 4)
+			pream = WMI_RATE_PREAMBLE_CCK;
+
+		if (band == IEEE80211_BAND_5GHZ)
+			i += 4;
+
+		if (i >= ARRAY_SIZE(cck_ofdm_rate))
+			return false;
+
+		rate = cck_ofdm_rate[i];
+		break;
+	case WMI_RATE_PREAMBLE_HT:
+		for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++)
+			if (mask->control[band].ht_mcs[i])
+				break;
+
+		if (i == IEEE80211_HT_MCS_MASK_LEN)
+			return false;
+
+		rate = ffs(mask->control[band].ht_mcs[i]) - 1;
+		nss = i;
+		break;
+	case WMI_RATE_PREAMBLE_VHT:
+		for (i = 0; i < NL80211_VHT_NSS_MAX; i++)
+			if (mask->control[band].vht_mcs[i])
+				break;
+
+		if (i == NL80211_VHT_NSS_MAX)
+			return false;
+
+		rate = ffs(mask->control[band].vht_mcs[i]) - 1;
+		nss = i;
+		break;
+	}
+
+	*fixed_nss = nss + 1;
+	nss <<= 4;
+	pream <<= 6;
+
+	ath10k_dbg(ATH10K_DBG_MAC, "mac fixed rate pream 0x%02x nss 0x%02x rate 0x%02x\n",
+		   pream, nss, rate);
+
+	*fixed_rate = pream | nss | rate;
+
+	return true;
+}
+
+static bool ath10k_get_fixed_rate_nss(const struct cfg80211_bitrate_mask *mask,
+				      enum ieee80211_band band,
+				      u8 *fixed_rate,
+				      u8 *fixed_nss)
+{
+	/* First check full NSS mask, if we can simply limit NSS */
+	if (ath10k_bitrate_mask_nss(mask, band, fixed_nss))
+		return true;
+
+	/* Next Check single rate is set */
+	return ath10k_bitrate_mask_rate(mask, band, fixed_rate, fixed_nss);
+}
+
+static int ath10k_set_fixed_rate_param(struct ath10k_vif *arvif,
+				       u8 fixed_rate,
+				       u8 fixed_nss)
+{
+	struct ath10k *ar = arvif->ar;
+	u32 vdev_param;
+	int ret = 0;
+
+	mutex_lock(&ar->conf_mutex);
+
+	if (arvif->fixed_rate == fixed_rate &&
+	    arvif->fixed_nss == fixed_nss)
+		goto exit;
+
+	if (fixed_rate == WMI_FIXED_RATE_NONE)
+		ath10k_dbg(ATH10K_DBG_MAC, "mac disable fixed bitrate mask\n");
+
+	vdev_param = ar->wmi.vdev_param->fixed_rate;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
+					vdev_param, fixed_rate);
+	if (ret) {
+		ath10k_warn("Could not set fixed_rate param 0x%02x: %d\n",
+			    fixed_rate, ret);
+		ret = -EINVAL;
+		goto exit;
+	}
+
+	arvif->fixed_rate = fixed_rate;
+
+	vdev_param = ar->wmi.vdev_param->nss;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
+					vdev_param, fixed_nss);
+
+	if (ret) {
+		ath10k_warn("Could not set fixed_nss param %d: %d\n",
+			    fixed_nss, ret);
+		ret = -EINVAL;
+		goto exit;
+	}
+
+	arvif->fixed_nss = fixed_nss;
+
+exit:
+	mutex_unlock(&ar->conf_mutex);
+	return ret;
+}
+
+static int ath10k_set_bitrate_mask(struct ieee80211_hw *hw,
+				   struct ieee80211_vif *vif,
+				   const struct cfg80211_bitrate_mask *mask)
+{
+	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+	struct ath10k *ar = arvif->ar;
+	enum ieee80211_band band = ar->hw->conf.chandef.chan->band;
+	u8 fixed_rate = WMI_FIXED_RATE_NONE;
+	u8 fixed_nss = ar->num_rf_chains;
+
+	if (!ath10k_default_bitrate_mask(ar, band, mask)) {
+		if (!ath10k_get_fixed_rate_nss(mask, band,
+					       &fixed_rate,
+					       &fixed_nss))
+			return -EINVAL;
+	}
+
+	return ath10k_set_fixed_rate_param(arvif, fixed_rate, fixed_nss);
+}
+
 static const struct ieee80211_ops ath10k_ops = {
 	.tx				= ath10k_tx,
 	.start				= ath10k_start,
@@ -3332,6 +3633,7 @@ static const struct ieee80211_ops ath10k_ops = {
 	.tx_last_beacon			= ath10k_tx_last_beacon,
 	.restart_complete		= ath10k_restart_complete,
 	.get_survey			= ath10k_get_survey,
+	.set_bitrate_mask		= ath10k_set_bitrate_mask,
 #ifdef CONFIG_PM
 	.suspend			= ath10k_suspend,
 	.resume				= ath10k_resume,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 0087d69..af36009 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -3003,6 +3003,18 @@ struct wmi_vdev_install_key_arg {
 	const void *key_data;
 };
 
+/*
+ * vdev fixed rate format:
+ * - preamble - b7:b6 - see WMI_RATE_PREMABLE_
+ * - nss      - b5:b4 - ss number (0 mean 1ss)
+ * - rate_mcs - b3:b0 - as below
+ *    CCK:  0 - 11Mbps, 1 - 5,5Mbps, 2 - 2Mbps, 3 - 1Mbps,
+ *          4 - 11Mbps (s), 5 - 5,5Mbps (s), 6 - 2Mbps (s)
+ *    OFDM: 0 - 48Mbps, 1 - 24Mbps, 2 - 12Mbps, 3 - 6Mbps,
+ *          4 - 54Mbps, 5 - 36Mbps, 6 - 18Mbps, 7 - 9Mbps
+ *    HT/VHT: MCS index
+ */
+
 /* Preamble types to be used with VDEV fixed rate configuration */
 enum wmi_rate_preamble {
 	WMI_RATE_PREAMBLE_OFDM,
-- 
1.7.9.5



From kvalo at qca.qualcomm.com  Wed Jan  8 03:23:18 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 8 Jan 2014 10:23:18 +0200
Subject: [PATCH 6/7] ath10k: Use new interfaces for MSI enablement
In-Reply-To: <dc640013c28e6e24b4f7293a8adbd2b60a8f48c4.1389103215.git.agordeev@redhat.com>
 (Alexander Gordeev's message of "Tue, 7 Jan 2014 19:05:41 +0100")
References: <cover.1389103215.git.agordeev@redhat.com>
 <dc640013c28e6e24b4f7293a8adbd2b60a8f48c4.1389103215.git.agordeev@redhat.com>
Message-ID: <87txdehog9.fsf@kamboji.qca.qualcomm.com>

Alexander Gordeev <agordeev at redhat.com> writes:

> This update also fixes a stylistic (naming and messaging only)
> confusion of MSI-X vs multiple MSIs which are not the same.
>
> Signed-off-by: Alexander Gordeev <agordeev at redhat.com>

Looks good to me.

Acked-by: Kalle Valo <kvalo at qca.qualcomm.com>

Do you want me to take this patch to my ath.git tree or how were you
planning to handle it?

-- 
Kalle Valo


From agordeev at redhat.com  Wed Jan  8 04:04:50 2014
From: agordeev at redhat.com (Alexander Gordeev)
Date: Wed, 8 Jan 2014 10:04:50 +0100
Subject: [PATCH 6/7] ath10k: Use new interfaces for MSI enablement
In-Reply-To: <87txdehog9.fsf@kamboji.qca.qualcomm.com>
References: <cover.1389103215.git.agordeev@redhat.com>
 <dc640013c28e6e24b4f7293a8adbd2b60a8f48c4.1389103215.git.agordeev@redhat.com>
 <87txdehog9.fsf@kamboji.qca.qualcomm.com>
Message-ID: <20140108090449.GC20157@dhcp-26-207.brq.redhat.com>

On Wed, Jan 08, 2014 at 10:23:18AM +0200, Kalle Valo wrote:
> Looks good to me.
> 
> Acked-by: Kalle Valo <kvalo at qca.qualcomm.com>

Thanks, Kalle.

> Do you want me to take this patch to my ath.git tree or how were you
> planning to handle it?

I see no option other than pushing it thru pci.git tree at this stage.

> -- 
> Kalle Valo

-- 
Regards,
Alexander Gordeev
agordeev at redhat.com


From marek.puzyniak at tieto.com  Wed Jan  8 05:40:09 2014
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Wed, 8 Jan 2014 11:40:09 +0100
Subject: [PATCH] ath10k: disable STA KICKOUT in FW
In-Reply-To: <CAEFj987Rxv9azS4EmW47a5guhVT-JijXsxSOgcGfvgwLkB9tEg@mail.gmail.com>
References: <1388390871-3932-1-git-send-email-marek.puzyniak@tieto.com>
 <CAEFj987Rxv9azS4EmW47a5guhVT-JijXsxSOgcGfvgwLkB9tEg@mail.gmail.com>
Message-ID: <CADnKcViXui6jCsBxgbYh5A2R4ra+p3YxBP-Om1cT5GaYjjAFPw@mail.gmail.com>

On 2 January 2014 13:41, Yeoh Chun-Yeow <yeohchunyeow at gmail.com> wrote:
>
> On Dec 30, 2013 4:08 PM, "Marek Puzyniak" <marek.puzyniak at tieto.com> wrote:
>>
>> Currently ath10k is not using STA KICKOUT firmware functionality.
>> In order to avoid unwanted FW events this functionality should be
>> disabled when not used.
>
> What are unwanted FW events?

WMI_PEER_STA_KICKOUT_EVENT which indicates lack of activity from
associated STA for specified period of time.

>
> ----
> Chun-Yeow
Marek
>
>> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
>> ---
>>  drivers/net/wireless/ath/ath10k/mac.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/mac.c
>> b/drivers/net/wireless/ath/ath10k/mac.c
>> index 5b45f3a..93416ab 100644
>> --- a/drivers/net/wireless/ath/ath10k/mac.c
>> +++ b/drivers/net/wireless/ath/ath10k/mac.c
>> @@ -2292,11 +2292,20 @@ static int ath10k_add_interface(struct
>> ieee80211_hw *hw,
>>         }
>>
>>         if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
>> +               u32 param_id;
>> +
>>                 ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr);
>>                 if (ret) {
>>                         ath10k_warn("Failed to create peer for AP: %d\n",
>> ret);
>>                         goto err_vdev_delete;
>>                 }
>> +
>> +               param_id = ar->wmi.pdev_param->sta_kickout_th;
>> +
>> +               /* Disable STA KICKOUT functionality in FW */
>> +               ret = ath10k_wmi_pdev_set_param(ar, param_id, 0);
>> +               if (ret)
>> +                       ath10k_warn("Failed to disable STA KICKOUT\n");
>>         }
>>
>>         if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
>> --
>> 1.8.1.2
>>
>>
>> _______________________________________________
>> ath10k mailing list
>> ath10k at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/ath10k


From kvalo at qca.qualcomm.com  Wed Jan  8 07:44:55 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 8 Jan 2014 14:44:55 +0200
Subject: [PATCH 6/7] ath10k: Use new interfaces for MSI enablement
In-Reply-To: <20140108090449.GC20157@dhcp-26-207.brq.redhat.com> (Alexander
 Gordeev's message of "Wed, 8 Jan 2014 10:04:50 +0100")
References: <cover.1389103215.git.agordeev@redhat.com>
 <dc640013c28e6e24b4f7293a8adbd2b60a8f48c4.1389103215.git.agordeev@redhat.com>
 <87txdehog9.fsf@kamboji.qca.qualcomm.com>
 <20140108090449.GC20157@dhcp-26-207.brq.redhat.com>
Message-ID: <87ob3mfxrs.fsf@kamboji.qca.qualcomm.com>

Alexander Gordeev <agordeev at redhat.com> writes:

> On Wed, Jan 08, 2014 at 10:23:18AM +0200, Kalle Valo wrote:
>
>> Do you want me to take this patch to my ath.git tree or how were you
>> planning to handle it?
>
> I see no option other than pushing it thru pci.git tree at this stage.

Thanks, I'll then just drop it from my queue.

-- 
Kalle Valo


From greearb at candelatech.com  Wed Jan  8 13:36:31 2014
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 08 Jan 2014 10:36:31 -0800
Subject: How to make software re-calc received frames with bad FCS?
Message-ID: <52CD9AAF.1040407@candelatech.com>

I'm back to trying to get multiple stations working to same AP
with WPA2 on ath10k.

I tried  doing 'nohwcrypt', but I had no luck with that.  I think
the firmware would require a fair bit of changes to make that happen.

So, a second plan is to just tell the firmware to use hardware crypt
for the VIFs.  This would have a good benefit of offloading the tx
path, at least.

This seems to work for transmit, but on receive, the hardware hash
collides since 2+ stations have same peer (ie, the AP).

I do receive packets, but they are flagged with FCS errors (and I think
there is no re-assembly of ampdu, but I'm not sure how much that matters).

My thought is to somehow flag these packets as needing to be decrypted
by software instead, similar to how the normal nohwcrypt logic works.

Any suggestions for how to go about attempting this?   Maybe
just force remove the CRC failure bit from the status before
passing up the stack?

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From yeohchunyeow at gmail.com  Thu Jan  9 04:09:52 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Thu, 9 Jan 2014 17:09:52 +0800
Subject: [PATCH] ath10k: disable STA KICKOUT in FW
In-Reply-To: <CADnKcViXui6jCsBxgbYh5A2R4ra+p3YxBP-Om1cT5GaYjjAFPw@mail.gmail.com>
References: <1388390871-3932-1-git-send-email-marek.puzyniak@tieto.com>
 <CAEFj987Rxv9azS4EmW47a5guhVT-JijXsxSOgcGfvgwLkB9tEg@mail.gmail.com>
 <CADnKcViXui6jCsBxgbYh5A2R4ra+p3YxBP-Om1cT5GaYjjAFPw@mail.gmail.com>
Message-ID: <CAEFj985kz+5DWx=hvDu=w=BEud0fJGbYMpUT939xVPbvFbXFPw@mail.gmail.com>

Hi, Marek

Do you mind to share which firmware that you are using?

I have tried your patch and this is set accordingly in an the AP (set
param 13). But once the associated STA is leaving,
WMI_PEER_STA_KICKOUT_EVENTID is still received.

[  145.060000] ath10k: wmi pdev set param 13 value 0
.......
[  148.560000] ath10k: wmi vdev id 0x0 set param 8 value 1
[  148.560000] ath10k: wmi peer create vdev_id 0 peer_addr 04:f0:21:0c:a5:44
[  148.560000] ath10k: wmi peer assoc vdev 0 addr 04:f0:21:0c:a5:44
[  149.040000] ath10k: wmi event debug mesg len 44
[  209.090000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  210.090000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID

FYI, I am using firmware version 999.999.0.636

ethtool -i wlan0
driver: ath10k_pci
firmware-version: 999.999.0.636

Thanks

Regards,
Chun-Yeow


On Wed, Jan 8, 2014 at 6:40 PM, Marek Puzyniak <marek.puzyniak at tieto.com> wrote:
> On 2 January 2014 13:41, Yeoh Chun-Yeow <yeohchunyeow at gmail.com> wrote:
>>
>> On Dec 30, 2013 4:08 PM, "Marek Puzyniak" <marek.puzyniak at tieto.com> wrote:
>>>
>>> Currently ath10k is not using STA KICKOUT firmware functionality.
>>> In order to avoid unwanted FW events this functionality should be
>>> disabled when not used.
>>
>> What are unwanted FW events?
>
> WMI_PEER_STA_KICKOUT_EVENT which indicates lack of activity from
> associated STA for specified period of time.
>
>>
>> ----
>> Chun-Yeow
> Marek
>>
>>> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
>>> ---
>>>  drivers/net/wireless/ath/ath10k/mac.c | 9 +++++++++
>>>  1 file changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath10k/mac.c
>>> b/drivers/net/wireless/ath/ath10k/mac.c
>>> index 5b45f3a..93416ab 100644
>>> --- a/drivers/net/wireless/ath/ath10k/mac.c
>>> +++ b/drivers/net/wireless/ath/ath10k/mac.c
>>> @@ -2292,11 +2292,20 @@ static int ath10k_add_interface(struct
>>> ieee80211_hw *hw,
>>>         }
>>>
>>>         if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
>>> +               u32 param_id;
>>> +
>>>                 ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr);
>>>                 if (ret) {
>>>                         ath10k_warn("Failed to create peer for AP: %d\n",
>>> ret);
>>>                         goto err_vdev_delete;
>>>                 }
>>> +
>>> +               param_id = ar->wmi.pdev_param->sta_kickout_th;
>>> +
>>> +               /* Disable STA KICKOUT functionality in FW */
>>> +               ret = ath10k_wmi_pdev_set_param(ar, param_id, 0);
>>> +               if (ret)
>>> +                       ath10k_warn("Failed to disable STA KICKOUT\n");
>>>         }
>>>
>>>         if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
>>> --
>>> 1.8.1.2
>>>
>>>
>>> _______________________________________________
>>> ath10k mailing list
>>> ath10k at lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/ath10k


From marek.puzyniak at tieto.com  Thu Jan  9 12:04:33 2014
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Thu,  9 Jan 2014 18:04:33 +0100
Subject: [PATCH] ath10k: implement and use new beacon method
Message-ID: <1389287073-10939-1-git-send-email-marek.puzyniak@tieto.com>

From: Michal Kazior <michal.kazior at tieto.com>

Until now ath10k used a copy-by-value beacon
submission.

The new method passes a DMA address via WMI
command only. This command contains additional
metadata that fixes AP behaviour with regard
to powersave buffering.

This also fixes strange bug when multicast traffic
would freeze TX indefinitely.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |  6 +++
 drivers/net/wireless/ath/ath10k/mac.c  | 11 ++++++
 drivers/net/wireless/ath/ath10k/wmi.c  | 72 +++++++++++++++++++++++-----------
 drivers/net/wireless/ath/ath10k/wmi.h  | 16 ++++++++
 4 files changed, 83 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 035cbf6..6e94579 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -61,6 +61,11 @@ struct ath10k_skb_cb {
 		u8 frag_len;
 		u8 pad_len;
 	} __packed htt;
+
+	struct {
+		bool dtim_zero;
+		bool deliver_cab;
+	} bcn;
 } __packed;
 
 static inline struct ath10k_skb_cb *ATH10K_SKB_CB(struct sk_buff *skb)
@@ -222,6 +227,7 @@ struct ath10k_vif {
 	u32 beacon_interval;
 	u32 dtim_period;
 	struct sk_buff *beacon;
+	bool beacon_sent;
 
 	struct ath10k *ar;
 	struct ieee80211_vif *vif;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 5b45f3a..98ce775 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -782,6 +782,17 @@ static void ath10k_control_beaconing(struct ath10k_vif *arvif,
 
 	if (!info->enable_beacon) {
 		ath10k_vdev_stop(arvif);
+
+		spin_lock_bh(&arvif->ar->data_lock);
+		if (arvif->beacon) {
+			ath10k_skb_unmap(arvif->ar->dev, arvif->beacon);
+			dev_kfree_skb_any(arvif->beacon);
+
+			arvif->beacon = NULL;
+			arvif->beacon_sent = false;
+		}
+		spin_unlock_bh(&arvif->ar->data_lock);
+
 		return;
 	}
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 3ec6c9a..85681c8 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -560,7 +560,6 @@ err_pull:
 
 static void ath10k_wmi_tx_beacon_nowait(struct ath10k_vif *arvif)
 {
-	struct wmi_bcn_tx_arg arg = {0};
 	int ret;
 
 	lockdep_assert_held(&arvif->ar->data_lock);
@@ -568,18 +567,18 @@ static void ath10k_wmi_tx_beacon_nowait(struct ath10k_vif *arvif)
 	if (arvif->beacon == NULL)
 		return;
 
-	arg.vdev_id = arvif->vdev_id;
-	arg.tx_rate = 0;
-	arg.tx_power = 0;
-	arg.bcn = arvif->beacon->data;
-	arg.bcn_len = arvif->beacon->len;
+	if (arvif->beacon_sent)
+		return;
 
-	ret = ath10k_wmi_beacon_send_nowait(arvif->ar, &arg);
+	ret = ath10k_wmi_beacon_send_ref_nowait(arvif->ar,
+						arvif->vdev_id,
+						arvif->beacon);
 	if (ret)
 		return;
 
-	dev_kfree_skb_any(arvif->beacon);
-	arvif->beacon = NULL;
+	/* We need to retain the arvif->beacon reference for DMA unmapping and
+	 * freeing the skbuff later. */
+	arvif->beacon_sent = true;
 }
 
 static void ath10k_wmi_tx_beacons_iter(void *data, u8 *mac,
@@ -1211,6 +1210,13 @@ static void ath10k_wmi_update_tim(struct ath10k *ar,
 	tim->bitmap_ctrl = !!__le32_to_cpu(bcn_info->tim_info.tim_mcast);
 	memcpy(tim->virtual_map, arvif->u.ap.tim_bitmap, pvm_len);
 
+	if (tim->dtim_count == 0) {
+		ATH10K_SKB_CB(bcn)->bcn.dtim_zero = true;
+
+		if (__le32_to_cpu(bcn_info->tim_info.tim_mcast) == 1)
+			ATH10K_SKB_CB(bcn)->bcn.deliver_cab = true;
+	}
+
 	ath10k_dbg(ATH10K_DBG_MGMT, "dtim %d/%d mcast %d pvmlen %d\n",
 		   tim->dtim_count, tim->dtim_period,
 		   tim->bitmap_ctrl, pvm_len);
@@ -1390,13 +1396,20 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb)
 		ath10k_wmi_update_noa(ar, arvif, bcn, bcn_info);
 
 		spin_lock_bh(&ar->data_lock);
+
 		if (arvif->beacon) {
-			ath10k_warn("SWBA overrun on vdev %d\n",
-				    arvif->vdev_id);
+			if (!arvif->beacon_sent)
+				ath10k_warn("SWBA overrun on vdev %d\n",
+					    arvif->vdev_id);
+
+			ath10k_skb_unmap(ar->dev, arvif->beacon);
 			dev_kfree_skb_any(arvif->beacon);
 		}
 
+		ath10k_skb_map(ar->dev, bcn);
+
 		arvif->beacon = bcn;
+		arvif->beacon_sent = false;
 
 		ath10k_wmi_tx_beacon_nowait(arvif);
 		spin_unlock_bh(&ar->data_lock);
@@ -3377,25 +3390,40 @@ int ath10k_wmi_peer_assoc(struct ath10k *ar,
 	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_assoc_cmdid);
 }
 
-int ath10k_wmi_beacon_send_nowait(struct ath10k *ar,
-				  const struct wmi_bcn_tx_arg *arg)
+/* This function assumes the beacon is already DMA mapped */
+int ath10k_wmi_beacon_send_ref_nowait(struct ath10k *ar, u32 vdev_id,
+				      struct sk_buff *beacon)
 {
-	struct wmi_bcn_tx_cmd *cmd;
+	struct wmi_bcn_tx_ref_cmd *cmd;
 	struct sk_buff *skb;
 	int ret;
+	struct ieee80211_hdr *hdr;
+	u16 fc;
 
-	skb = ath10k_wmi_alloc_skb(sizeof(*cmd) + arg->bcn_len);
+	skb = ath10k_wmi_alloc_skb(sizeof(*cmd));
 	if (!skb)
 		return -ENOMEM;
 
-	cmd = (struct wmi_bcn_tx_cmd *)skb->data;
-	cmd->hdr.vdev_id  = __cpu_to_le32(arg->vdev_id);
-	cmd->hdr.tx_rate  = __cpu_to_le32(arg->tx_rate);
-	cmd->hdr.tx_power = __cpu_to_le32(arg->tx_power);
-	cmd->hdr.bcn_len  = __cpu_to_le32(arg->bcn_len);
-	memcpy(cmd->bcn, arg->bcn, arg->bcn_len);
+	hdr = (struct ieee80211_hdr *)beacon->data;
+	fc = le16_to_cpu(hdr->frame_control);
+
+	cmd = (struct wmi_bcn_tx_ref_cmd *)skb->data;
+	cmd->vdev_id = __cpu_to_le32(vdev_id);
+	cmd->data_len = __cpu_to_le32(beacon->len);
+	cmd->data_ptr = __cpu_to_le32(ATH10K_SKB_CB(beacon)->paddr);
+	cmd->msdu_id = 0;
+	cmd->frame_control = __cpu_to_le32(fc); 
+	cmd->flags = 0;
+
+	if (ATH10K_SKB_CB(beacon)->bcn.dtim_zero)
+		cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DTIM_ZERO);
+
+	if (ATH10K_SKB_CB(beacon)->bcn.deliver_cab)
+		cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DELIVER_CAB);
+
+	ret = ath10k_wmi_cmd_send_nowait(ar, skb,
+					 ar->wmi.cmd->pdev_send_bcn_cmdid);
 
-	ret = ath10k_wmi_cmd_send_nowait(ar, skb, ar->wmi.cmd->bcn_tx_cmdid);
 	if (ret)
 		dev_kfree_skb(skb);
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 0087d69..cba56ff 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -3391,6 +3391,20 @@ struct wmi_bcn_tx_arg {
 	const void *bcn;
 };
 
+enum wmi_bcn_tx_ref_flags {
+	WMI_BCN_TX_REF_FLAG_DTIM_ZERO = 0x1,
+	WMI_BCN_TX_REF_FLAG_DELIVER_CAB = 0x2,
+};
+
+struct wmi_bcn_tx_ref_cmd {
+	__le32 vdev_id;
+	__le32 data_len;
+	__le32 data_ptr; /* dma pointer */
+	__le32 msdu_id; /* id for host to track */
+	__le32 frame_control;
+	__le32 flags; /* WMI_BCN_TX_REF_FLAG_ */
+} __packed;
+
 /* Beacon filter */
 #define WMI_BCN_FILTER_ALL   0 /* Filter all beacons */
 #define WMI_BCN_FILTER_NONE  1 /* Pass all beacons */
@@ -4167,5 +4181,7 @@ int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id);
 int ath10k_wmi_force_fw_hang(struct ath10k *ar,
 			     enum wmi_force_fw_hang_type type, u32 delay_ms);
 int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb);
+int ath10k_wmi_beacon_send_ref_nowait(struct ath10k *ar, u32 vdev_id,
+				      struct sk_buff *beacon);
 
 #endif /* _WMI_H_ */
-- 
1.8.1.2



From yeohchunyeow at gmail.com  Fri Jan 10 04:19:24 2014
From: yeohchunyeow at gmail.com (Chun-Yeow Yeoh)
Date: Fri, 10 Jan 2014 17:19:24 +0800
Subject: [PATCH v2] ath10k: fix the MAC address of peer statistic
Message-ID: <1389345564-21042-1-git-send-email-yeohchunyeow@gmail.com>

Fix the MAC address of wmi_peer_stats so that it is
printed correctly. This is tested and verified using
firmware version 999.999.0.636.

Based on the verification, maximum only 3 peer statistics including 
self STA able to be printed out.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow at gmail.com>
---
v2: offset the stats to ignore the first peer (Chun-Yeow)

 drivers/net/wireless/ath/ath10k/debug.c |    4 ++++
 drivers/net/wireless/ath/ath10k/wmi.h   |   14 +++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 6bdfad3..b39bad8 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -242,6 +242,10 @@ void ath10k_debug_read_target_stats(struct ath10k *ar,
 		}
 	}
 
+	/* The first peer is self MAC address, ignore this */
+	num_peer_stats--;
+	tmp += sizeof(struct wmi_peer_stats);
+
 	if (num_peer_stats) {
 		struct wmi_peer_stats *peer_stats;
 		struct ath10k_peer_stat *s;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 0087d69..106a23e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -200,12 +200,12 @@ struct wmi_mac_addr {
 
 /* macro to convert MAC address from WMI word format to char array */
 #define WMI_MAC_ADDR_TO_CHAR_ARRAY(pwmi_mac_addr, c_macaddr) do { \
-	(c_macaddr)[0] =  ((pwmi_mac_addr)->word0) & 0xff; \
-	(c_macaddr)[1] = (((pwmi_mac_addr)->word0) >> 8) & 0xff; \
-	(c_macaddr)[2] = (((pwmi_mac_addr)->word0) >> 16) & 0xff; \
-	(c_macaddr)[3] = (((pwmi_mac_addr)->word0) >> 24) & 0xff; \
-	(c_macaddr)[4] =  ((pwmi_mac_addr)->word1) & 0xff; \
-	(c_macaddr)[5] = (((pwmi_mac_addr)->word1) >> 8) & 0xff; \
+	(c_macaddr)[0] = (((pwmi_mac_addr)->word0) >> 24) & 0xff; \
+	(c_macaddr)[1] = (((pwmi_mac_addr)->word0) >> 16) & 0xff; \
+	(c_macaddr)[2] = (((pwmi_mac_addr)->word0) >> 8) & 0xff; \
+	(c_macaddr)[3] =  ((pwmi_mac_addr)->word0) & 0xff; \
+	(c_macaddr)[4] = (((pwmi_mac_addr)->word1) >> 24) & 0xff; \
+	(c_macaddr)[5] = (((pwmi_mac_addr)->word1) >> 16) & 0xff; \
 	} while (0)
 
 struct wmi_cmd_map {
@@ -2820,9 +2820,9 @@ struct wmi_vdev_stats {
  * TODO: add more stats
  */
 struct wmi_peer_stats {
+	__le32 peer_tx_rate;	/* TBA */
 	struct wmi_mac_addr peer_macaddr;
 	__le32 peer_rssi;
-	__le32 peer_tx_rate;
 } __packed;
 
 struct wmi_vdev_create_cmd {
-- 
1.7.9.5



From michal.kazior at tieto.com  Fri Jan 10 04:19:23 2014
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 10 Jan 2014 10:19:23 +0100
Subject: [PATCH] ath10k: add support for AP CSA
Message-ID: <1389345563-3445-1-git-send-email-michal.kazior@tieto.com>

This patch implements Channel Switch Announcement
for AP mode. This allows for a smooth channel
switch for connected stations that support CSA
when radar is detected.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |  1 +
 drivers/net/wireless/ath/ath10k/mac.c  | 80 +++++++++++++++++++++++++++++-----
 drivers/net/wireless/ath/ath10k/wmi.c  | 18 ++++++++
 3 files changed, 88 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 035cbf6..2554161 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -414,6 +414,7 @@ struct ath10k {
 	unsigned int filter_flags;
 	unsigned long dev_flags;
 	u32 dfs_block_radar_events;
+	struct ath10k_vif *csa_arvif;
 
 	struct wmi_pdev_set_wmm_params_arg wmm_params;
 	struct completion install_key_done;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 5b45f3a..5c26766 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -435,8 +435,7 @@ static inline int ath10k_vdev_setup_sync(struct ath10k *ar)
 static int ath10k_vdev_start(struct ath10k_vif *arvif)
 {
 	struct ath10k *ar = arvif->ar;
-	struct ieee80211_conf *conf = &ar->hw->conf;
-	struct ieee80211_channel *channel = conf->chandef.chan;
+	struct cfg80211_chan_def *chandef = &ar->hw->conf.chandef;
 	struct wmi_vdev_start_request_arg arg = {};
 	int ret = 0;
 
@@ -448,16 +447,14 @@ static int ath10k_vdev_start(struct ath10k_vif *arvif)
 	arg.dtim_period = arvif->dtim_period;
 	arg.bcn_intval = arvif->beacon_interval;
 
-	arg.channel.freq = channel->center_freq;
-
-	arg.channel.band_center_freq1 = conf->chandef.center_freq1;
-
-	arg.channel.mode = chan_to_phymode(&conf->chandef);
+	arg.channel.freq = chandef->chan->center_freq;
+	arg.channel.band_center_freq1 = chandef->center_freq1;
+	arg.channel.mode = chan_to_phymode(chandef);
 
 	arg.channel.min_power = 0;
-	arg.channel.max_power = channel->max_power * 2;
-	arg.channel.max_reg_power = channel->max_reg_power * 2;
-	arg.channel.max_antenna_gain = channel->max_antenna_gain * 2;
+	arg.channel.max_power = chandef->chan->max_power * 2;
+	arg.channel.max_reg_power = chandef->chan->max_reg_power * 2;
+	arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2;
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
 		arg.ssid = arvif->u.ap.ssid;
@@ -466,7 +463,7 @@ static int ath10k_vdev_start(struct ath10k_vif *arvif)
 
 		/* For now allow DFS for AP mode */
 		arg.channel.chan_radar =
-			!!(channel->flags & IEEE80211_CHAN_RADAR);
+			!!(chandef->chan->flags & IEEE80211_CHAN_RADAR);
 	} else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) {
 		arg.ssid = arvif->vif->bss_conf.ssid;
 		arg.ssid_len = arvif->vif->bss_conf.ssid_len;
@@ -2136,6 +2133,38 @@ static int ath10k_config_ps(struct ath10k *ar)
 	return ret;
 }
 
+static void ath10k_mac_update_ap_channel(struct ath10k_vif *arvif)
+{
+	const u8 *bssid = arvif->vif->bss_conf.bssid;
+	int ret;
+
+	ath10k_dbg(ATH10K_DBG_MAC, "mac AP channel update %dMHz\n",
+		   arvif->ar->hw->conf.chandef.chan->center_freq);
+
+	ret = ath10k_vdev_stop(arvif);
+	if (ret) {
+		ath10k_warn("could not stop vdev %d (%d)\n",
+			    arvif->vdev_id, ret);
+		return;
+	}
+
+	ret = ath10k_vdev_start(arvif);
+	if (ret) {
+		ath10k_warn("could not start vdev %d (%d)\n",
+			    arvif->vdev_id, ret);
+		return;
+	}
+
+	ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, 0, bssid);
+	if (ret) {
+		ath10k_warn("could not bring vdev up %d (%d)\n",
+			    arvif->vdev_id, ret);
+		return;
+	}
+
+	ath10k_dbg(ATH10K_DBG_MAC, "mac AP channel update complete\n");
+}
+
 static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
 {
 	struct ath10k *ar = hw->priv;
@@ -2156,6 +2185,9 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
 		spin_unlock_bh(&ar->data_lock);
 
 		ath10k_config_radar_detection(ar);
+
+		if (ar->csa_arvif && ar->csa_arvif->vif->csa_active)
+			ath10k_mac_update_ap_channel(ar->csa_arvif);
 	}
 
 	if (changed & IEEE80211_CONF_CHANGE_POWER) {
@@ -2495,6 +2527,12 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
 			   "vdev %d set beacon tx mode to staggered\n",
 			   arvif->vdev_id);
 
+		if (ar->csa_arvif) {
+			ath10k_dbg(ATH10K_DBG_MAC, "mac CSA completed for vdev_id %d\n",
+				   arvif->vdev_id);
+			ar->csa_arvif = NULL;
+		}
+
 		pdev_param = ar->wmi.pdev_param->beacon_tx_mode;
 		ret = ath10k_wmi_pdev_set_param(ar, pdev_param,
 						WMI_BEACON_STAGGERED_MODE);
@@ -3310,6 +3348,24 @@ exit:
 	return ret;
 }
 
+static void ath10k_channel_switch_beacon(struct ieee80211_hw *hw,
+					 struct ieee80211_vif *vif,
+					 struct cfg80211_chan_def *chandef)
+{
+	struct ath10k *ar = hw->priv;
+	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+
+	/* FIXME: Multi-VIF not supported */
+
+	if (ar->csa_arvif != NULL) {
+		ath10k_warn("CSA is already active for this device, ignoring!\n");
+		return;
+	}
+
+	ar->csa_arvif = arvif;
+	return;
+}
+
 static const struct ieee80211_ops ath10k_ops = {
 	.tx				= ath10k_tx,
 	.start				= ath10k_start,
@@ -3332,6 +3388,7 @@ static const struct ieee80211_ops ath10k_ops = {
 	.tx_last_beacon			= ath10k_tx_last_beacon,
 	.restart_complete		= ath10k_restart_complete,
 	.get_survey			= ath10k_get_survey,
+	.channel_switch_beacon		= ath10k_channel_switch_beacon,
 #ifdef CONFIG_PM
 	.suspend			= ath10k_suspend,
 	.resume				= ath10k_resume,
@@ -3712,6 +3769,7 @@ int ath10k_mac_register(struct ath10k *ar)
 	ar->hw->max_listen_interval = ATH10K_MAX_HW_LISTEN_INTERVAL;
 
 	ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
+	ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
 	ar->hw->wiphy->max_remain_on_channel_duration = 5000;
 
 	ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 3ec6c9a..5985197 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -558,6 +558,22 @@ err_pull:
 	return ret;
 }
 
+static void ath10k_update_csa(struct ath10k_vif *arvif)
+{
+	lockdep_assert_held(&arvif->ar->data_lock);
+
+	if (arvif->ar->csa_arvif != arvif)
+		return;
+
+	if (!arvif->vif->csa_active)
+		return;
+
+	if (!ieee80211_csa_is_complete(arvif->vif))
+		return;
+
+	ieee80211_csa_finish(arvif->vif);
+}
+
 static void ath10k_wmi_tx_beacon_nowait(struct ath10k_vif *arvif)
 {
 	struct wmi_bcn_tx_arg arg = {0};
@@ -580,6 +596,8 @@ static void ath10k_wmi_tx_beacon_nowait(struct ath10k_vif *arvif)
 
 	dev_kfree_skb_any(arvif->beacon);
 	arvif->beacon = NULL;
+
+	ath10k_update_csa(arvif);
 }
 
 static void ath10k_wmi_tx_beacons_iter(void *data, u8 *mac,
-- 
1.8.4.rc3



From kvalo at qca.qualcomm.com  Fri Jan 10 04:42:19 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 10 Jan 2014 11:42:19 +0200
Subject: [PATCH] ath10k: add DFS_CERTIFIED option
In-Reply-To: <1387298026-2599-1-git-send-email-janusz.dziedzic@tieto.com>
 (Janusz Dziedzic's message of "Tue, 17 Dec 2013 17:33:45 +0100")
References: <1387298026-2599-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <871u0gb2bo.fsf@kamboji.qca.qualcomm.com>

Janusz Dziedzic <janusz.dziedzic at tieto.com> writes:

> Add Kconfig option that allow DFS functionality.
>
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>

Thanks, DFS works for me now. Applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 10 04:45:54 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 10 Jan 2014 11:45:54 +0200
Subject: [PATCH] ath10k: disable STA KICKOUT in FW
In-Reply-To: <1388390871-3932-1-git-send-email-marek.puzyniak@tieto.com>
 (Marek Puzyniak's message of "Mon, 30 Dec 2013 09:07:51 +0100")
References: <1388390871-3932-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <87wqi89nl9.fsf@kamboji.qca.qualcomm.com>

Marek Puzyniak <marek.puzyniak at tieto.com> writes:

> Currently ath10k is not using STA KICKOUT firmware functionality.
> In order to avoid unwanted FW events this functionality should be
> disabled when not used.
>
> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>

Thanks, applied. I did minor changes to the commit log based on
the feedback:

    ath10k: disable STA kickout in FW
    
    Currently ath10k is not using STA KICKOUT firmware functionality.
    In order to avoid unwanted WMI_PEER_STA_KICKOUT_EVENT event this functionality
    should be disabled when not used.
    
    Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
    Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

> --- a/drivers/net/wireless/ath/ath10k/mac.c
> +++ b/drivers/net/wireless/ath/ath10k/mac.c
> @@ -2292,11 +2292,20 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
>  	}
>  
>  	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
> +		u32 param_id;
> +

Also I moved this to the beginning of the function.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 10 04:48:43 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 10 Jan 2014 11:48:43 +0200
Subject: [PATCH] ath10k: track number of existing peers
In-Reply-To: <1388669913-29031-1-git-send-email-bartosz.markowski@tieto.com>
 (Bartosz Markowski's message of "Thu, 2 Jan 2014 14:38:33 +0100")
References: <1388669913-29031-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <87sisw9ngk.fsf@kamboji.qca.qualcomm.com>

Bartosz Markowski <bartosz.markowski at tieto.com> writes:

> To not exceed number of allowed clients (AP mode), make sure to
> check how many of them are already on the peers list.
>
> 10.X firmware support up to 127 peers, non-AP centric firmwares 16.
>
> Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>

Thanks, applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 10 04:53:51 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 10 Jan 2014 11:53:51 +0200
Subject: [PATCH 0/3] ath10k: firmware dbglog and debug print events
In-Reply-To: <20140103105718.13474.70922.stgit@potku.adurom.net> (Kalle Valo's
 message of "Fri, 03 Jan 2014 12:59:13 +0200")
References: <20140103105718.13474.70922.stgit@potku.adurom.net>
Message-ID: <87ob3k9n80.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> Here are two new interfaces, dbglog and debug print events, to help with
> firmware debugging on ath10k. Please review.
>
> ---
>
> Kalle Valo (3):
>       ath10k: handle WMI debug print events
>       ath10k: add trace event for WMI_DEBUG_MESG_EVENTID
>       ath10k: add debugfs file to control firmware dbglog

All three applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 10 05:04:11 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 10 Jan 2014 12:04:11 +0200
Subject: [PATCH v3] ath10k: add set_bitrate_mask callback
In-Reply-To: <1389168513-5606-1-git-send-email-janusz.dziedzic@tieto.com>
 (Janusz Dziedzic's message of "Wed, 8 Jan 2014 09:08:33 +0100")
References: <1389168513-5606-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <87k3e89mqs.fsf@kamboji.qca.qualcomm.com>

Janusz Dziedzic <janusz.dziedzic at tieto.com> writes:

> Add set_bitrate_mask callback. Currently
> ath10k HW is limited to handle only single
> fixed rate setting or limit number of used
> spatial streams.
>
> Example:
> iw wlanX set bitrates legacy-5 ht-mcs-5 vht-mcs-5 2:9
> will setup VHT, nss=2, mcs=9
>
> iw wlanX set bitrates legacy-5 18 ht-mcs-5 vht-mcs-5
> will setup legacy, 18Mbps
>
> iw wlanX set bitrates legacy-5 ht-mcs-5 3 vht-mcs-5
> will setup HT, nss=1, mcs=3
>
> iw wlanX set bitrate legacy-5 ht-mcs-5 vht-mcs-5 1:0-9
> will setup nss=1
>
> iw wlanX set bitrate legacy-5 ht-mcs-5 vht-mcs-5 1:0-9 2:0-9
> will setup nss=2
>
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>

Thanks, applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 10 05:22:14 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 10 Jan 2014 12:22:14 +0200
Subject: [PATCH] ath10k: add support for AP CSA
In-Reply-To: <1389345563-3445-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Fri, 10 Jan 2014 10:19:23 +0100")
References: <1389345563-3445-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <87d2k09lwp.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> This patch implements Channel Switch Announcement
> for AP mode. This allows for a smooth channel
> switch for connected stations that support CSA
> when radar is detected.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

I had few conflicts while applying to ath-next-test (the branch for
pending patches). Please double check my changes:

https://github.com/kvalo/ath/commit/c7bb77f4bf9986e6be4b522ba1e01cd78ebb66af

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 10 05:23:01 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 10 Jan 2014 12:23:01 +0200
Subject: [PATCH] ath10k: implement and use new beacon method
In-Reply-To: <1389287073-10939-1-git-send-email-marek.puzyniak@tieto.com>
 (Marek Puzyniak's message of "Thu, 9 Jan 2014 18:04:33 +0100")
References: <1389287073-10939-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <878uuo9lve.fsf@kamboji.qca.qualcomm.com>

Marek Puzyniak <marek.puzyniak at tieto.com> writes:

> From: Michal Kazior <michal.kazior at tieto.com>
>
> Until now ath10k used a copy-by-value beacon
> submission.
>
> The new method passes a DMA address via WMI
> command only. This command contains additional
> metadata that fixes AP behaviour with regard
> to powersave buffering.
>
> This also fixes strange bug when multicast traffic
> would freeze TX indefinitely.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>

Same here, also so few conflicts. Please check:

https://github.com/kvalo/ath/commit/b700fa4a953b3f01ee5ff167fb94943de13d6b34

-- 
Kalle Valo


From michal.kazior at tieto.com  Fri Jan 10 07:36:30 2014
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 10 Jan 2014 13:36:30 +0100
Subject: [PATCH] ath10k: add support for AP CSA
In-Reply-To: <87d2k09lwp.fsf@kamboji.qca.qualcomm.com>
References: <1389345563-3445-1-git-send-email-michal.kazior@tieto.com>
 <87d2k09lwp.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQkpKeLKoYD-TRKVJON2fLmakrX-9Osy07FhYW5BhfAi9g@mail.gmail.com>

On 10 January 2014 11:22, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Michal Kazior <michal.kazior at tieto.com> writes:
>
>> This patch implements Channel Switch Announcement
>> for AP mode. This allows for a smooth channel
>> switch for connected stations that support CSA
>> when radar is detected.
>>
>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>
> I had few conflicts while applying to ath-next-test (the branch for
> pending patches). Please double check my changes:
>
> https://github.com/kvalo/ath/commit/c7bb77f4bf9986e6be4b522ba1e01cd78ebb66af

It looks good, thanks.


Micha?


From marek.puzyniak at tieto.com  Mon Jan 13 03:40:06 2014
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Mon, 13 Jan 2014 09:40:06 +0100
Subject: [PATCH] ath10k: disable STA KICKOUT in FW
In-Reply-To: <CAEFj985kz+5DWx=hvDu=w=BEud0fJGbYMpUT939xVPbvFbXFPw@mail.gmail.com>
References: <1388390871-3932-1-git-send-email-marek.puzyniak@tieto.com>
 <CAEFj987Rxv9azS4EmW47a5guhVT-JijXsxSOgcGfvgwLkB9tEg@mail.gmail.com>
 <CADnKcViXui6jCsBxgbYh5A2R4ra+p3YxBP-Om1cT5GaYjjAFPw@mail.gmail.com>
 <CAEFj985kz+5DWx=hvDu=w=BEud0fJGbYMpUT939xVPbvFbXFPw@mail.gmail.com>
Message-ID: <CADnKcViYW_iXJYokjiDnC+MjR4xw-gn0ZPOcf-CVgROsXxtm5A@mail.gmail.com>

On 9 January 2014 10:09, Yeoh Chun-Yeow <yeohchunyeow at gmail.com> wrote:
> Hi, Marek
Hi,
>
> Do you mind to share which firmware that you are using?

I am using FW from:
https://github.com/kvalo/ath10k-firmware/blob/master/ap/firmware-2.bin_10.1.467-1

> I have tried your patch and this is set accordingly in an the AP (set
> param 13). But once the associated STA is leaving,
> WMI_PEER_STA_KICKOUT_EVENTID is still received.
>
> [  145.060000] ath10k: wmi pdev set param 13 value 0
> .......
> [  148.560000] ath10k: wmi vdev id 0x0 set param 8 value 1
> [  148.560000] ath10k: wmi peer create vdev_id 0 peer_addr 04:f0:21:0c:a5:44
> [  148.560000] ath10k: wmi peer assoc vdev 0 addr 04:f0:21:0c:a5:44
> [  149.040000] ath10k: wmi event debug mesg len 44
> [  209.090000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  210.090000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
>
> FYI, I am using firmware version 999.999.0.636
>
> ethtool -i wlan0
> driver: ath10k_pci
> firmware-version: 999.999.0.636
>
> Thanks
>
> Regards,
> Chun-Yeow
Marek
>
>
> On Wed, Jan 8, 2014 at 6:40 PM, Marek Puzyniak <marek.puzyniak at tieto.com> wrote:
>> On 2 January 2014 13:41, Yeoh Chun-Yeow <yeohchunyeow at gmail.com> wrote:
>>>
>>> On Dec 30, 2013 4:08 PM, "Marek Puzyniak" <marek.puzyniak at tieto.com> wrote:
>>>>
>>>> Currently ath10k is not using STA KICKOUT firmware functionality.
>>>> In order to avoid unwanted FW events this functionality should be
>>>> disabled when not used.
>>>
>>> What are unwanted FW events?
>>
>> WMI_PEER_STA_KICKOUT_EVENT which indicates lack of activity from
>> associated STA for specified period of time.
>>
>>>
>>> ----
>>> Chun-Yeow
>> Marek
>>>
>>>> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
>>>> ---
>>>>  drivers/net/wireless/ath/ath10k/mac.c | 9 +++++++++
>>>>  1 file changed, 9 insertions(+)
>>>>
>>>> diff --git a/drivers/net/wireless/ath/ath10k/mac.c
>>>> b/drivers/net/wireless/ath/ath10k/mac.c
>>>> index 5b45f3a..93416ab 100644
>>>> --- a/drivers/net/wireless/ath/ath10k/mac.c
>>>> +++ b/drivers/net/wireless/ath/ath10k/mac.c
>>>> @@ -2292,11 +2292,20 @@ static int ath10k_add_interface(struct
>>>> ieee80211_hw *hw,
>>>>         }
>>>>
>>>>         if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
>>>> +               u32 param_id;
>>>> +
>>>>                 ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr);
>>>>                 if (ret) {
>>>>                         ath10k_warn("Failed to create peer for AP: %d\n",
>>>> ret);
>>>>                         goto err_vdev_delete;
>>>>                 }
>>>> +
>>>> +               param_id = ar->wmi.pdev_param->sta_kickout_th;
>>>> +
>>>> +               /* Disable STA KICKOUT functionality in FW */
>>>> +               ret = ath10k_wmi_pdev_set_param(ar, param_id, 0);
>>>> +               if (ret)
>>>> +                       ath10k_warn("Failed to disable STA KICKOUT\n");
>>>>         }
>>>>
>>>>         if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
>>>> --
>>>> 1.8.1.2
>>>>
>>>>
>>>> _______________________________________________
>>>> ath10k mailing list
>>>> ath10k at lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/ath10k


From yeohchunyeow at gmail.com  Mon Jan 13 04:51:32 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Mon, 13 Jan 2014 17:51:32 +0800
Subject: [PATCH] ath10k: disable STA KICKOUT in FW
In-Reply-To: <CADnKcViYW_iXJYokjiDnC+MjR4xw-gn0ZPOcf-CVgROsXxtm5A@mail.gmail.com>
References: <1388390871-3932-1-git-send-email-marek.puzyniak@tieto.com>
 <CAEFj987Rxv9azS4EmW47a5guhVT-JijXsxSOgcGfvgwLkB9tEg@mail.gmail.com>
 <CADnKcViXui6jCsBxgbYh5A2R4ra+p3YxBP-Om1cT5GaYjjAFPw@mail.gmail.com>
 <CAEFj985kz+5DWx=hvDu=w=BEud0fJGbYMpUT939xVPbvFbXFPw@mail.gmail.com>
 <CADnKcViYW_iXJYokjiDnC+MjR4xw-gn0ZPOcf-CVgROsXxtm5A@mail.gmail.com>
Message-ID: <CAEFj985LQAdQiBf4mQ6Ka54y-A_JitpHWeXXZMNj0AEtnX89Vw@mail.gmail.com>

Unfortunately, I have tried your mentioned firmware, but I am still
getting the WMI_PEER_STA_KICKOUT_EVENTID.

[  159.020000] ath10k: wmi pdev set param 13 value 0
.....
[  181.380000] ath10k: wmi peer assoc vdev 0 addr 04:f0:21:0c:a5:44
[  182.000000] ath10k: wmi event debug mesg len 44
[  182.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  183.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  184.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  185.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  185.580000] ath10k: wmi mgmt tx skb 86845f00 len 176 ftype 00 stype 50
[  185.580000] ath10k: wmi mgmt tx skb 86846180 len 176 ftype 00 stype 50
[  186.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  187.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  188.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  189.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  190.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  191.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  192.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  193.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  194.050000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
[  195.050000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID

# ethtool -i wlan0
driver: ath10k_pci
version: 3.3.8
firmware-version: 10.1.467-1

Am I miss out something?

----
Chun-Yeow


On Mon, Jan 13, 2014 at 4:40 PM, Marek Puzyniak
<marek.puzyniak at tieto.com> wrote:
> On 9 January 2014 10:09, Yeoh Chun-Yeow <yeohchunyeow at gmail.com> wrote:
>> Hi, Marek
> Hi,
>>
>> Do you mind to share which firmware that you are using?
>
> I am using FW from:
> https://github.com/kvalo/ath10k-firmware/blob/master/ap/firmware-2.bin_10.1.467-1
>
>> I have tried your patch and this is set accordingly in an the AP (set
>> param 13). But once the associated STA is leaving,
>> WMI_PEER_STA_KICKOUT_EVENTID is still received.
>>
>> [  145.060000] ath10k: wmi pdev set param 13 value 0
>> .......
>> [  148.560000] ath10k: wmi vdev id 0x0 set param 8 value 1
>> [  148.560000] ath10k: wmi peer create vdev_id 0 peer_addr 04:f0:21:0c:a5:44
>> [  148.560000] ath10k: wmi peer assoc vdev 0 addr 04:f0:21:0c:a5:44
>> [  149.040000] ath10k: wmi event debug mesg len 44
>> [  209.090000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
>> [  210.090000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
>>
>> FYI, I am using firmware version 999.999.0.636
>>
>> ethtool -i wlan0
>> driver: ath10k_pci
>> firmware-version: 999.999.0.636
>>
>> Thanks
>>
>> Regards,
>> Chun-Yeow
> Marek
>>
>>
>> On Wed, Jan 8, 2014 at 6:40 PM, Marek Puzyniak <marek.puzyniak at tieto.com> wrote:
>>> On 2 January 2014 13:41, Yeoh Chun-Yeow <yeohchunyeow at gmail.com> wrote:
>>>>
>>>> On Dec 30, 2013 4:08 PM, "Marek Puzyniak" <marek.puzyniak at tieto.com> wrote:
>>>>>
>>>>> Currently ath10k is not using STA KICKOUT firmware functionality.
>>>>> In order to avoid unwanted FW events this functionality should be
>>>>> disabled when not used.
>>>>
>>>> What are unwanted FW events?
>>>
>>> WMI_PEER_STA_KICKOUT_EVENT which indicates lack of activity from
>>> associated STA for specified period of time.
>>>
>>>>
>>>> ----
>>>> Chun-Yeow
>>> Marek
>>>>
>>>>> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
>>>>> ---
>>>>>  drivers/net/wireless/ath/ath10k/mac.c | 9 +++++++++
>>>>>  1 file changed, 9 insertions(+)
>>>>>
>>>>> diff --git a/drivers/net/wireless/ath/ath10k/mac.c
>>>>> b/drivers/net/wireless/ath/ath10k/mac.c
>>>>> index 5b45f3a..93416ab 100644
>>>>> --- a/drivers/net/wireless/ath/ath10k/mac.c
>>>>> +++ b/drivers/net/wireless/ath/ath10k/mac.c
>>>>> @@ -2292,11 +2292,20 @@ static int ath10k_add_interface(struct
>>>>> ieee80211_hw *hw,
>>>>>         }
>>>>>
>>>>>         if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
>>>>> +               u32 param_id;
>>>>> +
>>>>>                 ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr);
>>>>>                 if (ret) {
>>>>>                         ath10k_warn("Failed to create peer for AP: %d\n",
>>>>> ret);
>>>>>                         goto err_vdev_delete;
>>>>>                 }
>>>>> +
>>>>> +               param_id = ar->wmi.pdev_param->sta_kickout_th;
>>>>> +
>>>>> +               /* Disable STA KICKOUT functionality in FW */
>>>>> +               ret = ath10k_wmi_pdev_set_param(ar, param_id, 0);
>>>>> +               if (ret)
>>>>> +                       ath10k_warn("Failed to disable STA KICKOUT\n");
>>>>>         }
>>>>>
>>>>>         if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
>>>>> --
>>>>> 1.8.1.2
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ath10k mailing list
>>>>> ath10k at lists.infradead.org
>>>>> http://lists.infradead.org/mailman/listinfo/ath10k


From kvalo at qca.qualcomm.com  Mon Jan 13 07:00:28 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 13 Jan 2014 14:00:28 +0200
Subject: Pull request: ath 20140113
Message-ID: <87fvos3xcz.fsf@kamboji.qca.qualcomm.com>

Hi John,

here's another ath10k pull request. Major changes are:

Janusz added Kconfig option for DFS. The DFS code was there already, but
after fixes to mac80211 we can now enable it.

Bartosz added a runtime firmware feature flag to disable P2P. Our 10.1
firmware branch doesn't support P2P and ath10k can now disable that. He
also added a limit for how many clients can connect to ath10k AP.

Michal fixed WEP shared authentication, in case someone still uses it.
And I added firmware debug log to help the firmware engineers.

Please let me know if there any problems.

The following changes since commit 39731b78b4afebb7501c05b68e2443a1b250b41c:

  ath9k: simplify/fix tx packet TID handling (2013-12-19 14:41:57 -0500)

are available in the git repository at:

  git://github.com/kvalo/ath.git for-linville

for you to fetch changes up to 51ab1a0a09a894442e8b091d57222c5425b6d700:

  ath10k: add set_bitrate_mask callback (2014-01-10 11:54:49 +0200)

----------------------------------------------------------------
Bartosz Markowski (3):
      ath10k: split the if_limits and if_comb
      ath10k: introduce NO_P2P fw feature flag
      ath10k: track number of existing peers

Janusz Dziedzic (3):
      ath10k: handle TKIP MIC error correctly
      ath10k: add DFS_CERTIFIED option
      ath10k: add set_bitrate_mask callback

Kalle Valo (4):
      Merge remote-tracking branch 'wireless-next/master' into ath-next
      ath10k: handle WMI debug print events
      ath10k: add trace event for WMI_DEBUG_MESG_EVENTID
      ath10k: add debugfs file to control firmware dbglog

Marek Puzyniak (1):
      ath10k: disable STA kickout in FW

Michal Kazior (2):
      ath10k: fix WEP Shared authentication
      ath10k: fix band reporting for mgmt CCK frames on 5GHz

 drivers/net/wireless/ath/ath10k/Kconfig  |    7 +
 drivers/net/wireless/ath/ath10k/core.h   |   11 +
 drivers/net/wireless/ath/ath10k/debug.c  |   66 ++++++
 drivers/net/wireless/ath/ath10k/htt.h    |    1 +
 drivers/net/wireless/ath/ath10k/htt_rx.c |   15 ++
 drivers/net/wireless/ath/ath10k/hw.h     |    1 +
 drivers/net/wireless/ath/ath10k/mac.c    |  374 ++++++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath10k/trace.h  |   21 ++
 drivers/net/wireless/ath/ath10k/txrx.c   |    2 +-
 drivers/net/wireless/ath/ath10k/wmi.c    |  106 ++++++++-
 drivers/net/wireless/ath/ath10k/wmi.h    |   61 +++++
 11 files changed, 642 insertions(+), 23 deletions(-)

-- 
Kalle Valo


From greearb at candelatech.com  Mon Jan 13 14:36:08 2014
From: greearb at candelatech.com (Ben Greear)
Date: Mon, 13 Jan 2014 11:36:08 -0800
Subject: Anyone had any luck with 'raw' packet mode?
Message-ID: <52D44028.8020204@candelatech.com>

I managed to get raw mode working for receiving packets,
but on transmit, I cannot get any packets actually transmitted
on the air (per my sniffer).

Anyone know what might be needed to get this working?

For instance, should we be sending raw frames with frags,
or more like we currently send management frames?

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From linville at tuxdriver.com  Mon Jan 13 14:40:24 2014
From: linville at tuxdriver.com (John W. Linville)
Date: Mon, 13 Jan 2014 14:40:24 -0500
Subject: Pull request: ath 20140113
In-Reply-To: <87fvos3xcz.fsf@kamboji.qca.qualcomm.com>
References: <87fvos3xcz.fsf@kamboji.qca.qualcomm.com>
Message-ID: <20140113194024.GD14400@tuxdriver.com>

On Mon, Jan 13, 2014 at 02:00:28PM +0200, Kalle Valo wrote:
> Hi John,
> 
> here's another ath10k pull request. Major changes are:
> 
> Janusz added Kconfig option for DFS. The DFS code was there already, but
> after fixes to mac80211 we can now enable it.
> 
> Bartosz added a runtime firmware feature flag to disable P2P. Our 10.1
> firmware branch doesn't support P2P and ath10k can now disable that. He
> also added a limit for how many clients can connect to ath10k AP.
> 
> Michal fixed WEP shared authentication, in case someone still uses it.
> And I added firmware debug log to help the firmware engineers.
> 
> Please let me know if there any problems.
> 
> The following changes since commit 39731b78b4afebb7501c05b68e2443a1b250b41c:
> 
>   ath9k: simplify/fix tx packet TID handling (2013-12-19 14:41:57 -0500)
> 
> are available in the git repository at:
> 
>   git://github.com/kvalo/ath.git for-linville
> 
> for you to fetch changes up to 51ab1a0a09a894442e8b091d57222c5425b6d700:
> 
>   ath10k: add set_bitrate_mask callback (2014-01-10 11:54:49 +0200)

Pulling now...

-- 
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.


From greearb at candelatech.com  Mon Jan 13 23:50:07 2014
From: greearb at candelatech.com (Ben Greear)
Date: Mon, 13 Jan 2014 20:50:07 -0800
Subject: Anyone had any luck with 'raw' packet mode?
In-Reply-To: <CAEFj9848W9i+n=ys=LMd7TPXPtP0LOPmmOiqQscJC2ZuuT2Hsw@mail.gmail.com>
References: <52D44028.8020204@candelatech.com>
 <CAEFj9848W9i+n=ys=LMd7TPXPtP0LOPmmOiqQscJC2ZuuT2Hsw@mail.gmail.com>
Message-ID: <52D4C1FF.4060909@candelatech.com>

On 01/13/2014 06:03 PM, Yeoh Chun-Yeow wrote:
> Is your packet sniffer capture frame on 20MHz, 40MHz or 80MHz? Anyone manage to do on 80MHz?

Just HT40, and I'm only trying to use ath10k as stations in /n mode currently.

As soon as I can get that working, I'll start on more interesting /ac features.

Thanks,
Ben

>
> -----
> Chun-Yeow
>
> On Jan 14, 2014 3:36 AM, "Ben Greear" <greearb at candelatech.com <mailto:greearb at candelatech.com>> wrote:
>
>     I managed to get raw mode working for receiving packets,
>     but on transmit, I cannot get any packets actually transmitted
>     on the air (per my sniffer).
>
>     Anyone know what might be needed to get this working?
>
>     For instance, should we be sending raw frames with frags,
>     or more like we currently send management frames?
>
>     Thanks,
>     Ben
>
>     --
>     Ben Greear <greearb at candelatech.com <mailto:greearb at candelatech.com>>
>     Candela Technologies Inc http://www.candelatech.com
>
>
>     _______________________________________________
>     ath10k mailing list
>     ath10k at lists.infradead.org <mailto:ath10k at lists.infradead.org>
>     http://lists.infradead.org/mailman/listinfo/ath10k
>


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From bartosz.markowski at tieto.com  Tue Jan 14 01:38:17 2014
From: bartosz.markowski at tieto.com (Bartosz Markowski)
Date: Tue, 14 Jan 2014 12:08:17 +0530
Subject: [PATCH] ath10k: use VHT phymodes for 20/40MHz channels
Message-ID: <1389681497-18267-1-git-send-email-bartosz.markowski@tieto.com>

chandef does not provide 11n / 11ac split. Use the highest
phymodes for 20/40MHz channels, firmware can operate on.

Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 7aa6c4d..e0b1a2a 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -256,10 +256,10 @@ chan_to_phymode(const struct cfg80211_chan_def *chandef)
 			phymode = MODE_11A;
 			break;
 		case NL80211_CHAN_WIDTH_20:
-			phymode = MODE_11NA_HT20;
+			phymode = MODE_11AC_VHT20;
 			break;
 		case NL80211_CHAN_WIDTH_40:
-			phymode = MODE_11NA_HT40;
+			phymode = MODE_11AC_VHT40;
 			break;
 		case NL80211_CHAN_WIDTH_80:
 			phymode = MODE_11AC_VHT80;
-- 
1.7.9.5



From marek.puzyniak at tieto.com  Wed Jan 15 01:23:44 2014
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Wed, 15 Jan 2014 07:23:44 +0100
Subject: [PATCH] ath10k: disable STA KICKOUT in FW
In-Reply-To: <CAEFj985LQAdQiBf4mQ6Ka54y-A_JitpHWeXXZMNj0AEtnX89Vw@mail.gmail.com>
References: <1388390871-3932-1-git-send-email-marek.puzyniak@tieto.com>
 <CAEFj987Rxv9azS4EmW47a5guhVT-JijXsxSOgcGfvgwLkB9tEg@mail.gmail.com>
 <CADnKcViXui6jCsBxgbYh5A2R4ra+p3YxBP-Om1cT5GaYjjAFPw@mail.gmail.com>
 <CAEFj985kz+5DWx=hvDu=w=BEud0fJGbYMpUT939xVPbvFbXFPw@mail.gmail.com>
 <CADnKcViYW_iXJYokjiDnC+MjR4xw-gn0ZPOcf-CVgROsXxtm5A@mail.gmail.com>
 <CAEFj985LQAdQiBf4mQ6Ka54y-A_JitpHWeXXZMNj0AEtnX89Vw@mail.gmail.com>
Message-ID: <CADnKcVjYyVfyjzJgoOTTLFWrOj3drok32B6ZgBBWAa1N5kzAKQ@mail.gmail.com>

On 13 January 2014 10:51, Yeoh Chun-Yeow <yeohchunyeow at gmail.com> wrote:
> Unfortunately, I have tried your mentioned firmware, but I am still
> getting the WMI_PEER_STA_KICKOUT_EVENTID.
>
> [  159.020000] ath10k: wmi pdev set param 13 value 0
> .....
> [  181.380000] ath10k: wmi peer assoc vdev 0 addr 04:f0:21:0c:a5:44
> [  182.000000] ath10k: wmi event debug mesg len 44
> [  182.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  183.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  184.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  185.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  185.580000] ath10k: wmi mgmt tx skb 86845f00 len 176 ftype 00 stype 50
> [  185.580000] ath10k: wmi mgmt tx skb 86846180 len 176 ftype 00 stype 50
> [  186.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  187.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  188.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  189.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  190.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  191.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  192.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  193.040000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  194.050000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
> [  195.050000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
>
> # ethtool -i wlan0
> driver: ath10k_pci
> version: 3.3.8
> firmware-version: 10.1.467-1
>
> Am I miss out something?

You are right there are still too much WMI_PEER_STA_KICKOUT_EVENTID events.
Soon there will followup patch which will handle all cases. It looks
like the first one covers only one situation when STA_KICKOUT event
can be generated.

>
> ----
> Chun-Yeow
Marek
>
>
> On Mon, Jan 13, 2014 at 4:40 PM, Marek Puzyniak
> <marek.puzyniak at tieto.com> wrote:
>> On 9 January 2014 10:09, Yeoh Chun-Yeow <yeohchunyeow at gmail.com> wrote:
>>> Hi, Marek
>> Hi,
>>>
>>> Do you mind to share which firmware that you are using?
>>
>> I am using FW from:
>> https://github.com/kvalo/ath10k-firmware/blob/master/ap/firmware-2.bin_10.1.467-1
>>
>>> I have tried your patch and this is set accordingly in an the AP (set
>>> param 13). But once the associated STA is leaving,
>>> WMI_PEER_STA_KICKOUT_EVENTID is still received.
>>>
>>> [  145.060000] ath10k: wmi pdev set param 13 value 0
>>> .......
>>> [  148.560000] ath10k: wmi vdev id 0x0 set param 8 value 1
>>> [  148.560000] ath10k: wmi peer create vdev_id 0 peer_addr 04:f0:21:0c:a5:44
>>> [  148.560000] ath10k: wmi peer assoc vdev 0 addr 04:f0:21:0c:a5:44
>>> [  149.040000] ath10k: wmi event debug mesg len 44
>>> [  209.090000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
>>> [  210.090000] ath10k: WMI_PEER_STA_KICKOUT_EVENTID
>>>
>>> FYI, I am using firmware version 999.999.0.636
>>>
>>> ethtool -i wlan0
>>> driver: ath10k_pci
>>> firmware-version: 999.999.0.636
>>>
>>> Thanks
>>>
>>> Regards,
>>> Chun-Yeow
>> Marek
>>>
>>>
>>> On Wed, Jan 8, 2014 at 6:40 PM, Marek Puzyniak <marek.puzyniak at tieto.com> wrote:
>>>> On 2 January 2014 13:41, Yeoh Chun-Yeow <yeohchunyeow at gmail.com> wrote:
>>>>>
>>>>> On Dec 30, 2013 4:08 PM, "Marek Puzyniak" <marek.puzyniak at tieto.com> wrote:
>>>>>>
>>>>>> Currently ath10k is not using STA KICKOUT firmware functionality.
>>>>>> In order to avoid unwanted FW events this functionality should be
>>>>>> disabled when not used.
>>>>>
>>>>> What are unwanted FW events?
>>>>
>>>> WMI_PEER_STA_KICKOUT_EVENT which indicates lack of activity from
>>>> associated STA for specified period of time.
>>>>
>>>>>
>>>>> ----
>>>>> Chun-Yeow
>>>> Marek
>>>>>
>>>>>> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
>>>>>> ---
>>>>>>  drivers/net/wireless/ath/ath10k/mac.c | 9 +++++++++
>>>>>>  1 file changed, 9 insertions(+)
>>>>>>
>>>>>> diff --git a/drivers/net/wireless/ath/ath10k/mac.c
>>>>>> b/drivers/net/wireless/ath/ath10k/mac.c
>>>>>> index 5b45f3a..93416ab 100644
>>>>>> --- a/drivers/net/wireless/ath/ath10k/mac.c
>>>>>> +++ b/drivers/net/wireless/ath/ath10k/mac.c
>>>>>> @@ -2292,11 +2292,20 @@ static int ath10k_add_interface(struct
>>>>>> ieee80211_hw *hw,
>>>>>>         }
>>>>>>
>>>>>>         if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
>>>>>> +               u32 param_id;
>>>>>> +
>>>>>>                 ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr);
>>>>>>                 if (ret) {
>>>>>>                         ath10k_warn("Failed to create peer for AP: %d\n",
>>>>>> ret);
>>>>>>                         goto err_vdev_delete;
>>>>>>                 }
>>>>>> +
>>>>>> +               param_id = ar->wmi.pdev_param->sta_kickout_th;
>>>>>> +
>>>>>> +               /* Disable STA KICKOUT functionality in FW */
>>>>>> +               ret = ath10k_wmi_pdev_set_param(ar, param_id, 0);
>>>>>> +               if (ret)
>>>>>> +                       ath10k_warn("Failed to disable STA KICKOUT\n");
>>>>>>         }
>>>>>>
>>>>>>         if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
>>>>>> --
>>>>>> 1.8.1.2
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> ath10k mailing list
>>>>>> ath10k at lists.infradead.org
>>>>>> http://lists.infradead.org/mailman/listinfo/ath10k
>
> _______________________________________________
> ath10k mailing list
> ath10k at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k


From yeohchunyeow at gmail.com  Thu Jan 16 04:18:24 2014
From: yeohchunyeow at gmail.com (Chun-Yeow Yeoh)
Date: Thu, 16 Jan 2014 17:18:24 +0800
Subject: [PATCH] ath10k: set the AP keepalive timer
Message-ID: <1389863904-7159-1-git-send-email-yeohchunyeow@gmail.com>

Set the AP keepalive timer as following:
ap_keepalive_min_idle_inactive_time_secs to 60 seconds
ap_keepalive_max_idle_inactive_time_secs to 120 seconds
ap_keepalive_max_unresponsive_time_secs to 300 seconds

This ensure that the WMI_PEER_STA_KICKOUT_EVENTID is triggered
by the FW only once the unresponsive timer is expired.

Tested with firmware version 999.999.0.636 but the timer
is still default to 100 seconds. Tested with firmware 
version 10.1.467-1, the timer is set according to 
ap_keepalive_max_unresponsive_time_secs.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow at gmail.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   22 ++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h |    3 +++
 2 files changed, 25 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 776e364..2141034 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2313,6 +2313,28 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 		ret = ath10k_wmi_pdev_set_param(ar, param_id, 0);
 		if (ret)
 			ath10k_warn("Failed to disable STA KICKOUT\n");
+
+		/* Set the AP keepalive timer */
+		vdev_param =
+			ar->wmi.vdev_param->ap_keepalive_min_idle_inactive_time_secs;
+		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
+			WMI_VDEV_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS);
+		if (ret)
+			ath10k_warn("Failed to set keepalive min idle timer\n");
+
+		vdev_param =
+			ar->wmi.vdev_param->ap_keepalive_max_idle_inactive_time_secs;
+		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
+			WMI_VDEV_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS);
+		if (ret)
+			ath10k_warn("Failed to set keepalive max idle timer\n");
+
+		vdev_param =
+			ar->wmi.vdev_param->ap_keepalive_max_unresponsive_time_secs;
+		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
+			WMI_VDEV_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS);
+		if (ret)
+			ath10k_warn("Failed to set keepalive unresponsive timer\n");
 	}
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 4b5e7d3..7ce002a 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -3080,6 +3080,9 @@ struct wmi_vdev_param_map {
 };
 
 #define WMI_VDEV_PARAM_UNSUPPORTED 0
+#define WMI_VDEV_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS 60
+#define WMI_VDEV_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS 120
+#define WMI_VDEV_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS 300
 
 /* the definition of different VDEV parameters */
 enum wmi_vdev_param {
-- 
1.7.9.5



From kvalo at qca.qualcomm.com  Thu Jan 16 04:27:10 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 16 Jan 2014 11:27:10 +0200
Subject: [PATCH] ath10k: set the AP keepalive timer
In-Reply-To: <1389863904-7159-1-git-send-email-yeohchunyeow@gmail.com>
 (Chun-Yeow Yeoh's message of "Thu, 16 Jan 2014 17:18:24 +0800")
References: <1389863904-7159-1-git-send-email-yeohchunyeow@gmail.com>
Message-ID: <877ga0uvip.fsf@kamboji.qca.qualcomm.com>

Chun-Yeow Yeoh <yeohchunyeow at gmail.com> writes:

> Set the AP keepalive timer as following:
> ap_keepalive_min_idle_inactive_time_secs to 60 seconds
> ap_keepalive_max_idle_inactive_time_secs to 120 seconds
> ap_keepalive_max_unresponsive_time_secs to 300 seconds
>
> This ensure that the WMI_PEER_STA_KICKOUT_EVENTID is triggered
> by the FW only once the unresponsive timer is expired.
>
> Tested with firmware version 999.999.0.636 but the timer
> is still default to 100 seconds. Tested with firmware 
> version 10.1.467-1, the timer is set according to 
> ap_keepalive_max_unresponsive_time_secs.
>
> Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow at gmail.com>

Heh, bad timing. Yesterday I implemented STA quick kickout and in that
patch I set the same parameters as you did. I just used longer values to
avoid inactivity timeouts triggering in the firmware. We have the same
functionality in hostapd, so there's no need to use the one in firmware.

I'll send my patch after lunch, please take a look at that and see if
it's ok.

-- 
Kalle Valo


From yeohchunyeow at gmail.com  Thu Jan 16 04:32:37 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Thu, 16 Jan 2014 17:32:37 +0800
Subject: [PATCH] ath10k: set the AP keepalive timer
In-Reply-To: <877ga0uvip.fsf@kamboji.qca.qualcomm.com>
References: <1389863904-7159-1-git-send-email-yeohchunyeow@gmail.com>
 <877ga0uvip.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CAEFj9864XNeSKQRfVuo+KAKr76DVFM574arTCLLCTN+otzktAQ@mail.gmail.com>

> Heh, bad timing. Yesterday I implemented STA quick kickout and in that
> patch I set the same parameters as you did. I just used longer values to
> avoid inactivity timeouts triggering in the firmware. We have the same
> functionality in hostapd, so there's no need to use the one in firmware.
>
> I'll send my patch after lunch, please take a look at that and see if
> it's ok.
Ok, no problem.

I am annoying that immediately getting continuous
WMI_PEER_STA_KICKOUT_EVENTID message even though the STA is active
when tested with firmware 10.1.467-1.

----
Chun-Yeow


From kvalo at qca.qualcomm.com  Thu Jan 16 07:33:36 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 16 Jan 2014 14:33:36 +0200
Subject: [PATCH] ath10k: enable firmware STA quick kickout
Message-ID: <20140116123336.24551.2629.stgit@potku.adurom.net>

Firmware has a feature to track if the associated STA is not acking the frames.
When that happens, the firmware sends WMI_PEER_STA_KICKOUT_EVENTID event to the
host. Enable that to faster detect when a STA has left BSS without sending a
deauth frame.

Also set huge keepalive timeouts to avoid using the keepalive functionality in
the firmware.

Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.h |   12 +++++++
 drivers/net/wireless/ath/ath10k/mac.c  |   55 ++++++++++++++++++++++++++++----
 drivers/net/wireless/ath/ath10k/wmi.c  |   22 ++++++++++++-
 drivers/net/wireless/ath/ath10k/wmi.h  |    4 ++
 4 files changed, 85 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ade1781..e6308f4 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -46,6 +46,18 @@
 
 #define ATH10K_MAX_NUM_MGMT_PENDING 128
 
+/* number of failed packets */
+#define ATH10K_KICKOUT_THRESHOLD 50
+
+/*
+ * Use insanely high numbers to make sure that the firmware implementation
+ * won't start, we have the same functionality already in hostapd. Unit
+ * is seconds.
+ */
+#define ATH10K_KEEPALIVE_MIN_IDLE 3747
+#define ATH10K_KEEPALIVE_MAX_IDLE 3895
+#define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
+
 struct ath10k;
 
 struct ath10k_skb_cb {
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 7aa6c4d..f5f7c6a 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -339,6 +339,47 @@ static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr)
 	return 0;
 }
 
+static int ath10k_mac_set_kickout(struct ath10k_vif *arvif)
+{
+	struct ath10k *ar = arvif->ar;
+	u32 param;
+	int ret;
+
+	param = ar->wmi.pdev_param->sta_kickout_th;
+	ret = ath10k_wmi_pdev_set_param(ar, param,
+					ATH10K_KICKOUT_THRESHOLD);
+	if (ret) {
+		ath10k_warn("Failed to enable sta kickout: %d\n", ret);
+		return ret;
+	}
+
+	param = ar->wmi.vdev_param->ap_keepalive_min_idle_inactive_time_secs;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
+					ATH10K_KEEPALIVE_MIN_IDLE);
+	if (ret) {
+		ath10k_warn("Failed to enable sta kickout: %d\n", ret);
+		return ret;
+	}
+
+	param = ar->wmi.vdev_param->ap_keepalive_max_idle_inactive_time_secs;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
+					ATH10K_KEEPALIVE_MAX_IDLE);
+	if (ret) {
+		ath10k_warn("Failed to enable sta kickout: %d\n", ret);
+		return ret;
+	}
+
+	param = ar->wmi.vdev_param->ap_keepalive_max_unresponsive_time_secs;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
+					ATH10K_KEEPALIVE_MAX_UNRESPONSIVE);
+	if (ret) {
+		ath10k_warn("Failed to enable sta kickout: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 static int  ath10k_mac_set_rts(struct ath10k_vif *arvif, u32 value)
 {
 	struct ath10k *ar = arvif->ar;
@@ -2214,7 +2255,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
 	enum wmi_sta_powersave_param param;
 	int ret = 0;
-	u32 value, param_id;
+	u32 value;
 	int bit;
 	u32 vdev_param;
 
@@ -2307,12 +2348,12 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 			goto err_vdev_delete;
 		}
 
-		param_id = ar->wmi.pdev_param->sta_kickout_th;
-
-		/* Disable STA KICKOUT functionality in FW */
-		ret = ath10k_wmi_pdev_set_param(ar, param_id, 0);
-		if (ret)
-			ath10k_warn("Failed to disable STA KICKOUT\n");
+		ret = ath10k_mac_set_kickout(arvif);
+		if (ret) {
+			ath10k_warn("Failed to set kickout parameters: %d\n",
+				    ret);
+			goto err_peer_delete;
+		}
 	}
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 712a606..0bc8543 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1116,7 +1116,27 @@ static void ath10k_wmi_event_vdev_stopped(struct ath10k *ar,
 static void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar,
 					      struct sk_buff *skb)
 {
-	ath10k_dbg(ATH10K_DBG_WMI, "WMI_PEER_STA_KICKOUT_EVENTID\n");
+	struct wmi_peer_sta_kickout_event *ev;
+	struct ieee80211_sta *sta;
+
+	ev = (struct wmi_peer_sta_kickout_event *)skb->data;
+
+	ath10k_dbg(ATH10K_DBG_WMI, "wmi event peer sta kickout %pM\n",
+		   ev->peer_macaddr.addr);
+
+	rcu_read_lock();
+
+	sta = ieee80211_find_sta_by_ifaddr(ar->hw, ev->peer_macaddr.addr, NULL);
+	if (!sta) {
+		ath10k_warn("Spurious quick kickout for STA %pM\n",
+			    ev->peer_macaddr.addr);
+		goto exit;
+	}
+
+	ieee80211_report_low_ack(sta, 10);
+
+exit:
+	rcu_read_unlock();
 }
 
 /*
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 4b5e7d3..9dc90c5 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -4039,6 +4039,10 @@ struct wmi_chan_info_event {
 	__le32 cycle_count;
 } __packed;
 
+struct wmi_peer_sta_kickout_event {
+	struct wmi_mac_addr peer_macaddr;
+} __packed;
+
 #define WMI_CHAN_INFO_FLAG_COMPLETE BIT(0)
 
 /* FIXME: empirically extrapolated */



From yeohchunyeow at gmail.com  Thu Jan 16 07:44:43 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Thu, 16 Jan 2014 20:44:43 +0800
Subject: [PATCH] ath10k: enable firmware STA quick kickout
In-Reply-To: <20140116123336.24551.2629.stgit@potku.adurom.net>
References: <20140116123336.24551.2629.stgit@potku.adurom.net>
Message-ID: <CAEFj987MkPQgyTU=K64mXuzCnm7T3SsUOSXiHkAovTVz0_kqwg@mail.gmail.com>

Hi, Kalle Valo

Just would like to know whether the STA is deleted by FW when the FW
is sending the WMI_PEER_STA_KICKOUT_EVENTID to the host?

Please advice. Thanks

Regard,
Chun-Yeow

On Thu, Jan 16, 2014 at 8:33 PM, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Firmware has a feature to track if the associated STA is not acking the frames.
> When that happens, the firmware sends WMI_PEER_STA_KICKOUT_EVENTID event to the
> host. Enable that to faster detect when a STA has left BSS without sending a
> deauth frame.
>
> Also set huge keepalive timeouts to avoid using the keepalive functionality in
> the firmware.
>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
> ---
>  drivers/net/wireless/ath/ath10k/core.h |   12 +++++++
>  drivers/net/wireless/ath/ath10k/mac.c  |   55 ++++++++++++++++++++++++++++----
>  drivers/net/wireless/ath/ath10k/wmi.c  |   22 ++++++++++++-
>  drivers/net/wireless/ath/ath10k/wmi.h  |    4 ++
>  4 files changed, 85 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
> index ade1781..e6308f4 100644
> --- a/drivers/net/wireless/ath/ath10k/core.h
> +++ b/drivers/net/wireless/ath/ath10k/core.h
> @@ -46,6 +46,18 @@
>
>  #define ATH10K_MAX_NUM_MGMT_PENDING 128
>
> +/* number of failed packets */
> +#define ATH10K_KICKOUT_THRESHOLD 50
> +
> +/*
> + * Use insanely high numbers to make sure that the firmware implementation
> + * won't start, we have the same functionality already in hostapd. Unit
> + * is seconds.
> + */
> +#define ATH10K_KEEPALIVE_MIN_IDLE 3747
> +#define ATH10K_KEEPALIVE_MAX_IDLE 3895
> +#define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
> +
>  struct ath10k;
>
>  struct ath10k_skb_cb {
> diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
> index 7aa6c4d..f5f7c6a 100644
> --- a/drivers/net/wireless/ath/ath10k/mac.c
> +++ b/drivers/net/wireless/ath/ath10k/mac.c
> @@ -339,6 +339,47 @@ static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr)
>         return 0;
>  }
>
> +static int ath10k_mac_set_kickout(struct ath10k_vif *arvif)
> +{
> +       struct ath10k *ar = arvif->ar;
> +       u32 param;
> +       int ret;
> +
> +       param = ar->wmi.pdev_param->sta_kickout_th;
> +       ret = ath10k_wmi_pdev_set_param(ar, param,
> +                                       ATH10K_KICKOUT_THRESHOLD);
> +       if (ret) {
> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
> +               return ret;
> +       }
> +
> +       param = ar->wmi.vdev_param->ap_keepalive_min_idle_inactive_time_secs;
> +       ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
> +                                       ATH10K_KEEPALIVE_MIN_IDLE);
> +       if (ret) {
> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
> +               return ret;
> +       }
> +
> +       param = ar->wmi.vdev_param->ap_keepalive_max_idle_inactive_time_secs;
> +       ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
> +                                       ATH10K_KEEPALIVE_MAX_IDLE);
> +       if (ret) {
> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
> +               return ret;
> +       }
> +
> +       param = ar->wmi.vdev_param->ap_keepalive_max_unresponsive_time_secs;
> +       ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
> +                                       ATH10K_KEEPALIVE_MAX_UNRESPONSIVE);
> +       if (ret) {
> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
> +               return ret;
> +       }
> +
> +       return 0;
> +}
> +
>  static int  ath10k_mac_set_rts(struct ath10k_vif *arvif, u32 value)
>  {
>         struct ath10k *ar = arvif->ar;
> @@ -2214,7 +2255,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
>         struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
>         enum wmi_sta_powersave_param param;
>         int ret = 0;
> -       u32 value, param_id;
> +       u32 value;
>         int bit;
>         u32 vdev_param;
>
> @@ -2307,12 +2348,12 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
>                         goto err_vdev_delete;
>                 }
>
> -               param_id = ar->wmi.pdev_param->sta_kickout_th;
> -
> -               /* Disable STA KICKOUT functionality in FW */
> -               ret = ath10k_wmi_pdev_set_param(ar, param_id, 0);
> -               if (ret)
> -                       ath10k_warn("Failed to disable STA KICKOUT\n");
> +               ret = ath10k_mac_set_kickout(arvif);
> +               if (ret) {
> +                       ath10k_warn("Failed to set kickout parameters: %d\n",
> +                                   ret);
> +                       goto err_peer_delete;
> +               }
>         }
>
>         if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
> diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
> index 712a606..0bc8543 100644
> --- a/drivers/net/wireless/ath/ath10k/wmi.c
> +++ b/drivers/net/wireless/ath/ath10k/wmi.c
> @@ -1116,7 +1116,27 @@ static void ath10k_wmi_event_vdev_stopped(struct ath10k *ar,
>  static void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar,
>                                               struct sk_buff *skb)
>  {
> -       ath10k_dbg(ATH10K_DBG_WMI, "WMI_PEER_STA_KICKOUT_EVENTID\n");
> +       struct wmi_peer_sta_kickout_event *ev;
> +       struct ieee80211_sta *sta;
> +
> +       ev = (struct wmi_peer_sta_kickout_event *)skb->data;
> +
> +       ath10k_dbg(ATH10K_DBG_WMI, "wmi event peer sta kickout %pM\n",
> +                  ev->peer_macaddr.addr);
> +
> +       rcu_read_lock();
> +
> +       sta = ieee80211_find_sta_by_ifaddr(ar->hw, ev->peer_macaddr.addr, NULL);
> +       if (!sta) {
> +               ath10k_warn("Spurious quick kickout for STA %pM\n",
> +                           ev->peer_macaddr.addr);
> +               goto exit;
> +       }
> +
> +       ieee80211_report_low_ack(sta, 10);
> +
> +exit:
> +       rcu_read_unlock();
>  }
>
>  /*
> diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
> index 4b5e7d3..9dc90c5 100644
> --- a/drivers/net/wireless/ath/ath10k/wmi.h
> +++ b/drivers/net/wireless/ath/ath10k/wmi.h
> @@ -4039,6 +4039,10 @@ struct wmi_chan_info_event {
>         __le32 cycle_count;
>  } __packed;
>
> +struct wmi_peer_sta_kickout_event {
> +       struct wmi_mac_addr peer_macaddr;
> +} __packed;
> +
>  #define WMI_CHAN_INFO_FLAG_COMPLETE BIT(0)
>
>  /* FIXME: empirically extrapolated */
>
>
> _______________________________________________
> ath10k mailing list
> ath10k at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k


From kvalo at qca.qualcomm.com  Thu Jan 16 07:50:22 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 16 Jan 2014 14:50:22 +0200
Subject: [PATCH] ath10k: enable firmware STA quick kickout
In-Reply-To: <CAEFj987MkPQgyTU=K64mXuzCnm7T3SsUOSXiHkAovTVz0_kqwg@mail.gmail.com>
 (Yeoh Chun-Yeow's message of "Thu, 16 Jan 2014 20:44:43 +0800")
References: <20140116123336.24551.2629.stgit@potku.adurom.net>
 <CAEFj987MkPQgyTU=K64mXuzCnm7T3SsUOSXiHkAovTVz0_kqwg@mail.gmail.com>
Message-ID: <87ppnst7jl.fsf@kamboji.qca.qualcomm.com>

Yeoh Chun-Yeow <yeohchunyeow at gmail.com> writes:

> Just would like to know whether the STA is deleted by FW when the FW
> is sending the WMI_PEER_STA_KICKOUT_EVENTID to the host?

AFAICS the firmware just sends the event and assumes that the host
deletes the peer. Luckily in thise case it doesn't seem to do any peer
management on it's own.

-- 
Kalle Valo


From yeohchunyeow at gmail.com  Thu Jan 16 08:39:51 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Thu, 16 Jan 2014 21:39:51 +0800
Subject: [PATCH] ath10k: enable firmware STA quick kickout
In-Reply-To: <87ppnst7jl.fsf@kamboji.qca.qualcomm.com>
References: <20140116123336.24551.2629.stgit@potku.adurom.net>
 <CAEFj987MkPQgyTU=K64mXuzCnm7T3SsUOSXiHkAovTVz0_kqwg@mail.gmail.com>
 <87ppnst7jl.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CAEFj986GB5ehTMAWz-9qWOaqT=ck1T61AAgg-qxXLw-MS=q8cQ@mail.gmail.com>

Tested and worked.

Thanks

----
Chun-Yeow

On Thu, Jan 16, 2014 at 8:50 PM, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Yeoh Chun-Yeow <yeohchunyeow at gmail.com> writes:
>
>> Just would like to know whether the STA is deleted by FW when the FW
>> is sending the WMI_PEER_STA_KICKOUT_EVENTID to the host?
>
> AFAICS the firmware just sends the event and assumes that the host
> deletes the peer. Luckily in thise case it doesn't seem to do any peer
> management on it's own.
>
> --
> Kalle Valo


From jogo at openwrt.org  Fri Jan 17 04:01:06 2014
From: jogo at openwrt.org (Jonas Gorski)
Date: Fri, 17 Jan 2014 10:01:06 +0100
Subject: [PATCH] ath10k: enable firmware STA quick kickout
In-Reply-To: <20140116123336.24551.2629.stgit@potku.adurom.net>
References: <20140116123336.24551.2629.stgit@potku.adurom.net>
Message-ID: <CAOiHx=n77=CiFYfB3Y=jxOjVtmr06zvFhUe5R96Kq0HUgSLv5Q@mail.gmail.com>

On Thu, Jan 16, 2014 at 1:33 PM, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Firmware has a feature to track if the associated STA is not acking the frames.
> When that happens, the firmware sends WMI_PEER_STA_KICKOUT_EVENTID event to the
> host. Enable that to faster detect when a STA has left BSS without sending a
> deauth frame.
>
> Also set huge keepalive timeouts to avoid using the keepalive functionality in
> the firmware.
>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
> ---
>  drivers/net/wireless/ath/ath10k/core.h |   12 +++++++
>  drivers/net/wireless/ath/ath10k/mac.c  |   55 ++++++++++++++++++++++++++++----
>  drivers/net/wireless/ath/ath10k/wmi.c  |   22 ++++++++++++-
>  drivers/net/wireless/ath/ath10k/wmi.h  |    4 ++
>  4 files changed, 85 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
> index ade1781..e6308f4 100644
> --- a/drivers/net/wireless/ath/ath10k/core.h
> +++ b/drivers/net/wireless/ath/ath10k/core.h
> @@ -46,6 +46,18 @@
>
>  #define ATH10K_MAX_NUM_MGMT_PENDING 128
>
> +/* number of failed packets */
> +#define ATH10K_KICKOUT_THRESHOLD 50
> +
> +/*
> + * Use insanely high numbers to make sure that the firmware implementation
> + * won't start, we have the same functionality already in hostapd. Unit
> + * is seconds.
> + */
> +#define ATH10K_KEEPALIVE_MIN_IDLE 3747
> +#define ATH10K_KEEPALIVE_MAX_IDLE 3895
> +#define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
> +
>  struct ath10k;
>
>  struct ath10k_skb_cb {
> diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
> index 7aa6c4d..f5f7c6a 100644
> --- a/drivers/net/wireless/ath/ath10k/mac.c
> +++ b/drivers/net/wireless/ath/ath10k/mac.c
> @@ -339,6 +339,47 @@ static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr)
>         return 0;
>  }
>
> +static int ath10k_mac_set_kickout(struct ath10k_vif *arvif)
> +{
> +       struct ath10k *ar = arvif->ar;
> +       u32 param;
> +       int ret;
> +
> +       param = ar->wmi.pdev_param->sta_kickout_th;
> +       ret = ath10k_wmi_pdev_set_param(ar, param,
> +                                       ATH10K_KICKOUT_THRESHOLD);
> +       if (ret) {
> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
> +               return ret;
> +       }
> +
> +       param = ar->wmi.vdev_param->ap_keepalive_min_idle_inactive_time_secs;
> +       ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
> +                                       ATH10K_KEEPALIVE_MIN_IDLE);
> +       if (ret) {
> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
> +               return ret;
> +       }
> +
> +       param = ar->wmi.vdev_param->ap_keepalive_max_idle_inactive_time_secs;
> +       ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
> +                                       ATH10K_KEEPALIVE_MAX_IDLE);
> +       if (ret) {
> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
> +               return ret;
> +       }
> +
> +       param = ar->wmi.vdev_param->ap_keepalive_max_unresponsive_time_secs;
> +       ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
> +                                       ATH10K_KEEPALIVE_MAX_UNRESPONSIVE);
> +       if (ret) {
> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
> +               return ret;
> +       }

Did you intend to have differing warnings here? Currently it will be
hard to tell which of these calls have failed based on the warning
(assuming ath10k_warn does not print the source code line it was
invoked from).


Jonas


From kvalo at qca.qualcomm.com  Fri Jan 17 04:23:22 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 17 Jan 2014 11:23:22 +0200
Subject: [PATCH] ath10k: enable firmware STA quick kickout
In-Reply-To: <CAOiHx=n77=CiFYfB3Y=jxOjVtmr06zvFhUe5R96Kq0HUgSLv5Q@mail.gmail.com>
 (Jonas Gorski's message of "Fri, 17 Jan 2014 10:01:06 +0100")
References: <20140116123336.24551.2629.stgit@potku.adurom.net>
 <CAOiHx=n77=CiFYfB3Y=jxOjVtmr06zvFhUe5R96Kq0HUgSLv5Q@mail.gmail.com>
Message-ID: <871u07rmgl.fsf@kamboji.qca.qualcomm.com>

Jonas Gorski <jogo at openwrt.org> writes:

> On Thu, Jan 16, 2014 at 1:33 PM, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>> Firmware has a feature to track if the associated STA is not acking the frames.
>> When that happens, the firmware sends WMI_PEER_STA_KICKOUT_EVENTID event to the
>> host. Enable that to faster detect when a STA has left BSS without sending a
>> deauth frame.
>>
>> Also set huge keepalive timeouts to avoid using the keepalive functionality in
>> the firmware.
>>
>> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

[...]

>> +       param = ar->wmi.pdev_param->sta_kickout_th;
>> +       ret = ath10k_wmi_pdev_set_param(ar, param,
>> +                                       ATH10K_KICKOUT_THRESHOLD);
>> +       if (ret) {
>> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
>> +               return ret;
>> +       }
>> +
>> +       param = ar->wmi.vdev_param->ap_keepalive_min_idle_inactive_time_secs;
>> +       ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
>> +                                       ATH10K_KEEPALIVE_MIN_IDLE);
>> +       if (ret) {
>> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
>> +               return ret;
>> +       }
>> +
>> +       param = ar->wmi.vdev_param->ap_keepalive_max_idle_inactive_time_secs;
>> +       ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
>> +                                       ATH10K_KEEPALIVE_MAX_IDLE);
>> +       if (ret) {
>> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
>> +               return ret;
>> +       }
>> +
>> +       param = ar->wmi.vdev_param->ap_keepalive_max_unresponsive_time_secs;
>> +       ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
>> +                                       ATH10K_KEEPALIVE_MAX_UNRESPONSIVE);
>> +       if (ret) {
>> +               ath10k_warn("Failed to enable sta kickout: %d\n", ret);
>> +               return ret;
>> +       }
>
> Did you intend to have differing warnings here? Currently it will be
> hard to tell which of these calls have failed based on the warning
> (assuming ath10k_warn does not print the source code line it was
> invoked from).

You are right, all warning/error messages in ath10k should be unique so
that the location can be easily found. I was actually supposed to fix
this before I send it for review, but apparently I forgot. I'll send v2.

Thanks!

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 17 07:24:56 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 17 Jan 2014 14:24:56 +0200
Subject: [PATCH v2] ath10k: fix the MAC address of peer statistic
In-Reply-To: <1389345564-21042-1-git-send-email-yeohchunyeow@gmail.com>
 (Chun-Yeow Yeoh's message of "Fri, 10 Jan 2014 17:19:24 +0800")
References: <1389345564-21042-1-git-send-email-yeohchunyeow@gmail.com>
Message-ID: <87txd2re1z.fsf@kamboji.qca.qualcomm.com>

Chun-Yeow Yeoh <yeohchunyeow at gmail.com> writes:

> Fix the MAC address of wmi_peer_stats so that it is
> printed correctly. This is tested and verified using
> firmware version 999.999.0.636.
>
> Based on the verification, maximum only 3 peer statistics including 
> self STA able to be printed out.
>
> Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow at gmail.com>
> ---
> v2: offset the stats to ignore the first peer (Chun-Yeow)

I think something is wrong still. I tested this with 999.999.0.636 on
x86 32 bit laptop in AP mode, connected STA 00:24:d7:9b:0b:7c to it and
still MAC address is wrong:

              PHY errors drops          0
   MPDU errors (FCS, MIC, ENC)          0

             ath10k PEER stats
             =================

              Peer MAC address 9b:d7:24:00:00:00
                     Peer RSSI 36
                  Peer TX rate 0

Without your patch it's also wrong:

             ath10k PEER stats
             =================

              Peer MAC address 00:00:00:00:02:00
                     Peer RSSI 3
                  Peer TX rate 0

              Peer MAC address 00:00:00:00:00:24
                     Peer RSSI 31755
                  Peer TX rate 0

Any ideas what's happening here?

> --- a/drivers/net/wireless/ath/ath10k/debug.c
> +++ b/drivers/net/wireless/ath/ath10k/debug.c
> @@ -242,6 +242,10 @@ void ath10k_debug_read_target_stats(struct ath10k *ar,
>  		}
>  	}
>  
> +	/* The first peer is self MAC address, ignore this */
> +	num_peer_stats--;
> +	tmp += sizeof(struct wmi_peer_stats);

Should we show "self peer" separately? Does it provide any useful
information?

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 17 07:31:27 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 17 Jan 2014 14:31:27 +0200
Subject: [PATCH] ath10k: use VHT phymodes for 20/40MHz channels
In-Reply-To: <1389681497-18267-1-git-send-email-bartosz.markowski@tieto.com>
 (Bartosz Markowski's message of "Tue, 14 Jan 2014 12:08:17 +0530")
References: <1389681497-18267-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <87ppnqrdr4.fsf@kamboji.qca.qualcomm.com>

Bartosz Markowski <bartosz.markowski at tieto.com> writes:

> chandef does not provide 11n / 11ac split. Use the highest
> phymodes for 20/40MHz channels, firmware can operate on.
>
> Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>

Is this just code cleanup and or does this actually fix something?

> --- a/drivers/net/wireless/ath/ath10k/mac.c
> +++ b/drivers/net/wireless/ath/ath10k/mac.c
> @@ -256,10 +256,10 @@ chan_to_phymode(const struct cfg80211_chan_def *chandef)
>  			phymode = MODE_11A;
>  			break;
>  		case NL80211_CHAN_WIDTH_20:
> -			phymode = MODE_11NA_HT20;
> +			phymode = MODE_11AC_VHT20;
>  			break;
>  		case NL80211_CHAN_WIDTH_40:
> -			phymode = MODE_11NA_HT40;
> +			phymode = MODE_11AC_VHT40;
>  			break;
>  		case NL80211_CHAN_WIDTH_80:
>  			phymode = MODE_11AC_VHT80;

But doesn't this mean that we will use, for example, MODE_11AC_VHT20 on
11n mode? I think we need to investigate how MODE_11AC_VHT20 and
MODE_11NA_HT20 actually differ (and the same for 40 MHz channels).

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 17 07:57:42 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 17 Jan 2014 14:57:42 +0200
Subject: [PATCH] ath10k: add support for AP CSA
In-Reply-To: <1389345563-3445-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Fri, 10 Jan 2014 10:19:23 +0100")
References: <1389345563-3445-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <87lhyercjd.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> This patch implements Channel Switch Announcement
> for AP mode. This allows for a smooth channel
> switch for connected stations that support CSA
> when radar is detected.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

[...]

> --- a/drivers/net/wireless/ath/ath10k/core.h
> +++ b/drivers/net/wireless/ath/ath10k/core.h
> @@ -414,6 +414,7 @@ struct ath10k {
>  	unsigned int filter_flags;
>  	unsigned long dev_flags;
>  	u32 dfs_block_radar_events;
> +	struct ath10k_vif *csa_arvif;

Please document how this is serialised.

> +static void ath10k_mac_update_ap_channel(struct ath10k_vif *arvif)
> +{

Please change this function to return the error code.

> +	const u8 *bssid = arvif->vif->bss_conf.bssid;
> +	int ret;
> +
> +	ath10k_dbg(ATH10K_DBG_MAC, "mac AP channel update %dMHz\n",
> +		   arvif->ar->hw->conf.chandef.chan->center_freq);
> +
> +	ret = ath10k_vdev_stop(arvif);
> +	if (ret) {
> +		ath10k_warn("could not stop vdev %d (%d)\n",
> +			    arvif->vdev_id, ret);
> +		return;
> +	}
> +
> +	ret = ath10k_vdev_start(arvif);
> +	if (ret) {
> +		ath10k_warn("could not start vdev %d (%d)\n",
> +			    arvif->vdev_id, ret);
> +		return;
> +	}
> +
> +	ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, 0, bssid);
> +	if (ret) {
> +		ath10k_warn("could not bring vdev up %d (%d)\n",
> +			    arvif->vdev_id, ret);
> +		return;
> +	}

For warning and error messages please use style:

"could not bring vdev up %d: %d\n"

> @@ -2156,6 +2185,9 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
>  		spin_unlock_bh(&ar->data_lock);
>  
>  		ath10k_config_radar_detection(ar);
> +
> +		if (ar->csa_arvif && ar->csa_arvif->vif->csa_active)
> +			ath10k_mac_update_ap_channel(ar->csa_arvif);

Check the error message here, print a warning and return if there's an
error. But should we return 0 or the error code, that I do not know.

> --- a/drivers/net/wireless/ath/ath10k/wmi.c
> +++ b/drivers/net/wireless/ath/ath10k/wmi.c
> @@ -558,6 +558,22 @@ err_pull:
>  	return ret;
>  }
>  
> +static void ath10k_update_csa(struct ath10k_vif *arvif)
> +{
> +	lockdep_assert_held(&arvif->ar->data_lock);
> +
> +	if (arvif->ar->csa_arvif != arvif)
> +		return;
> +
> +	if (!arvif->vif->csa_active)
> +		return;
> +
> +	if (!ieee80211_csa_is_complete(arvif->vif))
> +		return;
> +
> +	ieee80211_csa_finish(arvif->vif);
> +}

For consistency I would prefer that all functions return an error code,
but I guess that would not make any sense here. Does it?

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 17 08:04:31 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 17 Jan 2014 15:04:31 +0200
Subject: [PATCH] ath10k: implement and use new beacon method
In-Reply-To: <1389287073-10939-1-git-send-email-marek.puzyniak@tieto.com>
 (Marek Puzyniak's message of "Thu, 9 Jan 2014 18:04:33 +0100")
References: <1389287073-10939-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <87ha92rc80.fsf@kamboji.qca.qualcomm.com>

Marek Puzyniak <marek.puzyniak at tieto.com> writes:

> From: Michal Kazior <michal.kazior at tieto.com>
>
> Until now ath10k used a copy-by-value beacon
> submission.
>
> The new method passes a DMA address via WMI
> command only. This command contains additional
> metadata that fixes AP behaviour with regard
> to powersave buffering.
>
> This also fixes strange bug when multicast traffic
> would freeze TX indefinitely.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>

[...]

> --- a/drivers/net/wireless/ath/ath10k/core.h
> +++ b/drivers/net/wireless/ath/ath10k/core.h
> @@ -61,6 +61,11 @@ struct ath10k_skb_cb {
>  		u8 frag_len;
>  		u8 pad_len;
>  	} __packed htt;
> +
> +	struct {
> +		bool dtim_zero;
> +		bool deliver_cab;
> +	} bcn;
>  } __packed;

I think we will run out of space in skb_cb soon and we will need to
start using bitflags. But this is ok for now.

>  static inline struct ath10k_skb_cb *ATH10K_SKB_CB(struct sk_buff *skb)
> @@ -222,6 +227,7 @@ struct ath10k_vif {
>  	u32 beacon_interval;
>  	u32 dtim_period;
>  	struct sk_buff *beacon;
> +	bool beacon_sent;

Please document how this is protected.

> @@ -3377,25 +3390,40 @@ int ath10k_wmi_peer_assoc(struct ath10k *ar,
>  	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_assoc_cmdid);
>  }
>  
> -int ath10k_wmi_beacon_send_nowait(struct ath10k *ar,
> -				  const struct wmi_bcn_tx_arg *arg)
> +/* This function assumes the beacon is already DMA mapped */
> +int ath10k_wmi_beacon_send_ref_nowait(struct ath10k *ar, u32 vdev_id,
> +				      struct sk_buff *beacon)

I think this would be cleaner:

ath10k_wmi_beacon_send_ref_nowait(struct ath10k_vif *arvif,
 			      struct sk_buff *beacon)

Or maybe even without the beacon parameter? We get it from arvif anyway.

> --- a/drivers/net/wireless/ath/ath10k/wmi.h
> +++ b/drivers/net/wireless/ath/ath10k/wmi.h
> @@ -3391,6 +3391,20 @@ struct wmi_bcn_tx_arg {
>  	const void *bcn;
>  };
>  
> +enum wmi_bcn_tx_ref_flags {
> +	WMI_BCN_TX_REF_FLAG_DTIM_ZERO = 0x1,
> +	WMI_BCN_TX_REF_FLAG_DELIVER_CAB = 0x2,
> +};
> +
> +struct wmi_bcn_tx_ref_cmd {
> +	__le32 vdev_id;
> +	__le32 data_len;
> +	__le32 data_ptr; /* dma pointer */
> +	__le32 msdu_id; /* id for host to track */
> +	__le32 frame_control;
> +	__le32 flags; /* WMI_BCN_TX_REF_FLAG_ */
> +} __packed;

Comments before the field, please. Like here:

struct wmi_resource_config_10x {
	/* number of virtual devices (VAPs) to support */
	__le32 num_vdevs;

	/* number of peer nodes to support */
	__le32 num_peers;

	/* number of keys per peer */
	__le32 num_peer_keys;

	/* total number of TX/RX data TIDs */
	__le32 num_tids;

-- 
Kalle Valo


From janusz.dziedzic at tieto.com  Fri Jan 17 08:08:08 2014
From: janusz.dziedzic at tieto.com (Janusz Dziedzic)
Date: Fri, 17 Jan 2014 14:08:08 +0100
Subject: [PATCH] ath10k: enable wmi ps peer param command for 10.x FW
Message-ID: <1389964088-4458-1-git-send-email-janusz.dziedzic@tieto.com>

Enable ap_ps_peer_param_cmdid for 10.x FW.
This is used mainly for AP UAPSD.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 712a606..f49a842 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -213,7 +213,7 @@ static struct wmi_cmd_map wmi_10x_cmd_map = {
 	.p2p_go_set_beacon_ie = WMI_10X_P2P_GO_SET_BEACON_IE,
 	.p2p_go_set_probe_resp_ie = WMI_10X_P2P_GO_SET_PROBE_RESP_IE,
 	.p2p_set_vendor_ie_data_cmdid = WMI_CMD_UNSUPPORTED,
-	.ap_ps_peer_param_cmdid = WMI_CMD_UNSUPPORTED,
+	.ap_ps_peer_param_cmdid = WMI_10X_AP_PS_PEER_PARAM_CMDID,
 	.ap_ps_peer_uapsd_coex_cmdid = WMI_CMD_UNSUPPORTED,
 	.peer_rate_retry_sched_cmdid = WMI_10X_PEER_RATE_RETRY_SCHED_CMDID,
 	.wlan_profile_trigger_cmdid = WMI_10X_WLAN_PROFILE_TRIGGER_CMDID,
-- 
1.7.9.5



From yeohchunyeow at gmail.com  Fri Jan 17 08:11:24 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Fri, 17 Jan 2014 21:11:24 +0800
Subject: [PATCH v2] ath10k: fix the MAC address of peer statistic
In-Reply-To: <87txd2re1z.fsf@kamboji.qca.qualcomm.com>
References: <1389345564-21042-1-git-send-email-yeohchunyeow@gmail.com>
 <87txd2re1z.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CAEFj987bofbcHJh2=pvxujxZgLwFjgV+1UeLC5kfKZYqiQHyyg@mail.gmail.com>

> Any ideas what's happening here?

My one is MIPS32 (Compex WPJ344) and the following PEER stats are
printed correctly:

# cat /sys/kernel/debug/ieee80211/phy0/ath10k/fw_stats

   MPDU errors (FCS, MIC, ENC)          0

             ath10k PEER stats
             =================

              Peer MAC address 04:f0:21:0c:a5:44
                     Peer RSSI 68
                  Peer TX rate 0

Could this be the Endianness problem? How about if you remain the
struct wmi_peer_stats? Also, just to point out the TxRate is not
working (always 0).


>> +     /* The first peer is self MAC address, ignore this */
>> +     num_peer_stats--;
>> +     tmp += sizeof(struct wmi_peer_stats);
>
> Should we show "self peer" separately? Does it provide any useful
> information?

So far, we only have RSSI and Tx Rate. Both are not really useful for
"self peer".

----
Chun-Yeow


From michal.kazior at tieto.com  Fri Jan 17 08:18:43 2014
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 17 Jan 2014 14:18:43 +0100
Subject: [PATCH v2] ath10k: fix the MAC address of peer statistic
In-Reply-To: <1389345564-21042-1-git-send-email-yeohchunyeow@gmail.com>
References: <1389345564-21042-1-git-send-email-yeohchunyeow@gmail.com>
Message-ID: <CA+BoTQncY0esFNgo2MGzbrmu=xoXMCb1OMY0Uci0o-=4ATG=6Q@mail.gmail.com>

On 10 January 2014 10:19, Chun-Yeow Yeoh <yeohchunyeow at gmail.com> wrote:
> Fix the MAC address of wmi_peer_stats so that it is
> printed correctly. This is tested and verified using
> firmware version 999.999.0.636.
>
> Based on the verification, maximum only 3 peer statistics including
> self STA able to be printed out.
>
> Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow at gmail.com>
> ---
> v2: offset the stats to ignore the first peer (Chun-Yeow)
>
>  drivers/net/wireless/ath/ath10k/debug.c |    4 ++++
>  drivers/net/wireless/ath/ath10k/wmi.h   |   14 +++++++-------
>  2 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
> index 6bdfad3..b39bad8 100644
> --- a/drivers/net/wireless/ath/ath10k/debug.c
> +++ b/drivers/net/wireless/ath/ath10k/debug.c
> @@ -242,6 +242,10 @@ void ath10k_debug_read_target_stats(struct ath10k *ar,
>                 }
>         }
>
> +       /* The first peer is self MAC address, ignore this */
> +       num_peer_stats--;
> +       tmp += sizeof(struct wmi_peer_stats);
> +
>         if (num_peer_stats) {
>                 struct wmi_peer_stats *peer_stats;
>                 struct ath10k_peer_stat *s;
> diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
> index 0087d69..106a23e 100644
> --- a/drivers/net/wireless/ath/ath10k/wmi.h
> +++ b/drivers/net/wireless/ath/ath10k/wmi.h
> @@ -200,12 +200,12 @@ struct wmi_mac_addr {
>
>  /* macro to convert MAC address from WMI word format to char array */
>  #define WMI_MAC_ADDR_TO_CHAR_ARRAY(pwmi_mac_addr, c_macaddr) do { \
> -       (c_macaddr)[0] =  ((pwmi_mac_addr)->word0) & 0xff; \
> -       (c_macaddr)[1] = (((pwmi_mac_addr)->word0) >> 8) & 0xff; \
> -       (c_macaddr)[2] = (((pwmi_mac_addr)->word0) >> 16) & 0xff; \
> -       (c_macaddr)[3] = (((pwmi_mac_addr)->word0) >> 24) & 0xff; \
> -       (c_macaddr)[4] =  ((pwmi_mac_addr)->word1) & 0xff; \
> -       (c_macaddr)[5] = (((pwmi_mac_addr)->word1) >> 8) & 0xff; \
> +       (c_macaddr)[0] = (((pwmi_mac_addr)->word0) >> 24) & 0xff; \
> +       (c_macaddr)[1] = (((pwmi_mac_addr)->word0) >> 16) & 0xff; \
> +       (c_macaddr)[2] = (((pwmi_mac_addr)->word0) >> 8) & 0xff; \
> +       (c_macaddr)[3] =  ((pwmi_mac_addr)->word0) & 0xff; \
> +       (c_macaddr)[4] = (((pwmi_mac_addr)->word1) >> 24) & 0xff; \
> +       (c_macaddr)[5] = (((pwmi_mac_addr)->word1) >> 16) & 0xff; \
>         } while (0)

This is totally wrong. This macro shouldn't be used anymore. It
shouldn't even be here. There's no hardware byte-swapping anymore.
This means mac addresses received from firmware should be treated
as-is, e.g. with memcpy(). See wmi_mac_addr definition - it has
`addr[6]` field which should be used.


Micha?


From michal.kazior at tieto.com  Fri Jan 17 08:38:00 2014
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 17 Jan 2014 14:38:00 +0100
Subject: [PATCH v2] ath10k: fix the MAC address of peer statistic
In-Reply-To: <1389345564-21042-1-git-send-email-yeohchunyeow@gmail.com>
References: <1389345564-21042-1-git-send-email-yeohchunyeow@gmail.com>
Message-ID: <CA+BoTQmexjQy-+Bv-uofBa2Ndcu56yYOAEeNzdBSE3yMCQdZKw@mail.gmail.com>

On 10 January 2014 10:19, Chun-Yeow Yeoh <yeohchunyeow at gmail.com> wrote:
> Fix the MAC address of wmi_peer_stats so that it is
> printed correctly. This is tested and verified using
> firmware version 999.999.0.636.
>
> Based on the verification, maximum only 3 peer statistics including
> self STA able to be printed out.
>
> Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow at gmail.com>
> ---
> v2: offset the stats to ignore the first peer (Chun-Yeow)
>
>  drivers/net/wireless/ath/ath10k/debug.c |    4 ++++
>  drivers/net/wireless/ath/ath10k/wmi.h   |   14 +++++++-------
>  2 files changed, 11 insertions(+), 7 deletions(-)
>

[...]

> @@ -2820,9 +2820,9 @@ struct wmi_vdev_stats {
>   * TODO: add more stats
>   */
>  struct wmi_peer_stats {
> +       __le32 peer_tx_rate;    /* TBA */
>         struct wmi_mac_addr peer_macaddr;
>         __le32 peer_rssi;
> -       __le32 peer_tx_rate;
>  } __packed;

This looks wrong too. I've just checked it and it seems the
`wal_dbg_tx_stats` is out of date. It's missing a `__le32
stateless_tid_alloc_failure` that has been inserted at some point in
time in the firmware between `pdev_resets` and `phy_underrun`. You
should add this missing field instead of moving `peer_tx_rate`.

Unfortunately AP firmware has even more fields inserted in
`wmi_pdev_stats`. Making this work with both firmwares is a mess.


Micha?


From kvalo at qca.qualcomm.com  Fri Jan 17 08:40:41 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 17 Jan 2014 15:40:41 +0200
Subject: [PATCH v2] ath10k: fix the MAC address of peer statistic
In-Reply-To: <CA+BoTQmexjQy-+Bv-uofBa2Ndcu56yYOAEeNzdBSE3yMCQdZKw@mail.gmail.com>
 (Michal Kazior's message of "Fri, 17 Jan 2014 14:38:00 +0100")
References: <1389345564-21042-1-git-send-email-yeohchunyeow@gmail.com>
 <CA+BoTQmexjQy-+Bv-uofBa2Ndcu56yYOAEeNzdBSE3yMCQdZKw@mail.gmail.com>
Message-ID: <87d2jqrajq.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 10 January 2014 10:19, Chun-Yeow Yeoh <yeohchunyeow at gmail.com> wrote:
>
>>  struct wmi_peer_stats {
>> +       __le32 peer_tx_rate;    /* TBA */
>>         struct wmi_mac_addr peer_macaddr;
>>         __le32 peer_rssi;
>> -       __le32 peer_tx_rate;
>>  } __packed;
>
> This looks wrong too. I've just checked it and it seems the
> `wal_dbg_tx_stats` is out of date. It's missing a `__le32
> stateless_tid_alloc_failure` that has been inserted at some point in
> time in the firmware between `pdev_resets` and `phy_underrun`. You
> should add this missing field instead of moving `peer_tx_rate`.
>
> Unfortunately AP firmware has even more fields inserted in
> `wmi_pdev_stats`. Making this work with both firmwares is a mess.

This reminds me that Bartosz sent something related to this few months back:

http://lists.infradead.org/pipermail/ath10k/2013-September/000317.html

I promised to finish it, but it's still in my todo folder :/

-- 
Kalle Valo


From michal.kazior at tieto.com  Fri Jan 17 08:46:39 2014
From: michal.kazior at tieto.com (Michal Kazior)
Date: Fri, 17 Jan 2014 14:46:39 +0100
Subject: [PATCH] ath10k: add support for AP CSA
In-Reply-To: <87lhyercjd.fsf@kamboji.qca.qualcomm.com>
References: <1389345563-3445-1-git-send-email-michal.kazior@tieto.com>
 <87lhyercjd.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQktbmjYJA91mJ_EU=iTtCOFiPNPjjxRm=yxiwxposS-rA@mail.gmail.com>

On 17 January 2014 13:57, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Michal Kazior <michal.kazior at tieto.com> writes:
>
>> This patch implements Channel Switch Announcement
>> for AP mode. This allows for a smooth channel
>> switch for connected stations that support CSA
>> when radar is detected.
>>
>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>
> [...]
>
>> --- a/drivers/net/wireless/ath/ath10k/core.h
>> +++ b/drivers/net/wireless/ath/ath10k/core.h
>> @@ -414,6 +414,7 @@ struct ath10k {
>>       unsigned int filter_flags;
>>       unsigned long dev_flags;
>>       u32 dfs_block_radar_events;
>> +     struct ath10k_vif *csa_arvif;
>
> Please document how this is serialised.

[...]

I have a local patch capable of multi-interface CSA which basically
rewrites this patch entirely. Unless you want me send that as a follow
up patch later I'd like to drop this patch and send a completely new
one later.


Micha?


From kvalo at qca.qualcomm.com  Fri Jan 17 10:15:03 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 17 Jan 2014 17:15:03 +0200
Subject: [PATCH] ath10k: add support for AP CSA
In-Reply-To: <CA+BoTQktbmjYJA91mJ_EU=iTtCOFiPNPjjxRm=yxiwxposS-rA@mail.gmail.com>
 (Michal Kazior's message of "Fri, 17 Jan 2014 14:46:39 +0100")
References: <1389345563-3445-1-git-send-email-michal.kazior@tieto.com>
 <87lhyercjd.fsf@kamboji.qca.qualcomm.com>
 <CA+BoTQktbmjYJA91mJ_EU=iTtCOFiPNPjjxRm=yxiwxposS-rA@mail.gmail.com>
Message-ID: <878uuer66g.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> On 17 January 2014 13:57, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>> Michal Kazior <michal.kazior at tieto.com> writes:
>>
>>> This patch implements Channel Switch Announcement
>>> for AP mode. This allows for a smooth channel
>>> switch for connected stations that support CSA
>>> when radar is detected.
>>>
>>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>>
>> [...]
>>
>>> --- a/drivers/net/wireless/ath/ath10k/core.h
>>> +++ b/drivers/net/wireless/ath/ath10k/core.h
>>> @@ -414,6 +414,7 @@ struct ath10k {
>>>       unsigned int filter_flags;
>>>       unsigned long dev_flags;
>>>       u32 dfs_block_radar_events;
>>> +     struct ath10k_vif *csa_arvif;
>>
>> Please document how this is serialised.
>
> [...]
>
> I have a local patch capable of multi-interface CSA which basically
> rewrites this patch entirely. Unless you want me send that as a follow
> up patch later I'd like to drop this patch and send a completely new
> one later.

Yeah, let's then just drop this patch.

-- 
Kalle Valo


From agordeev at redhat.com  Fri Jan 17 11:02:14 2014
From: agordeev at redhat.com (Alexander Gordeev)
Date: Fri, 17 Jan 2014 17:02:14 +0100
Subject: [PATCH v2 0/9] Phase out pci_enable_msi_block()
Message-ID: <cover.1389904166.git.agordeev@redhat.com>

This series is against "next" branch in Bjorn's repo:
git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git

Changes from v1 to v2:
  - added a regression fix "ahci: Fix broken fallback to single
    MSI mode" as patch 1/9;
  - the series is reordered to move the regression fix in front;
  - at Bjorn's request pci_enable_msi() is un-deprecated;
  - as result, pci_enable_msi_range(pdev, 1, 1) styled calls
    rolled back to pci_enable_msi(pdev);
  - nvme bug fix moved out as a separate patch 5/9 "nvme: Fix
    invalid call to irq_set_affinity_hint()"
  - patches changelog elaborated a bit;

Bjorn,

As the release is supposedly this weekend, do you prefer
the patches to go to your tree or to individual trees after
the release?

Thanks!

Alexander Gordeev (9):
  ahci: Fix broken fallback to single MSI mode
  ahci: Use pci_enable_msi_range()
  ipr: Get rid of superfluous call to pci_disable_msi/msix()
  ipr: Use pci_enable_msi_range() and pci_enable_msix_range()
  nvme: Fix invalid call to irq_set_affinity_hint()
  nvme: Use pci_enable_msi_range() and pci_enable_msix_range()
  vfio: Use pci_enable_msi_range() and pci_enable_msix_range()
  ath10k: Use pci_enable_msi_range()
  wil6210: Use pci_enable_msi_range()

 drivers/ata/ahci.c                          |   18 +++++-----
 drivers/block/nvme-core.c                   |   33 ++++-------------
 drivers/net/wireless/ath/ath10k/pci.c       |   20 +++++-----
 drivers/net/wireless/ath/wil6210/pcie_bus.c |   36 ++++++++++---------
 drivers/scsi/ipr.c                          |   51 +++++++++-----------------
 drivers/vfio/pci/vfio_pci_intrs.c           |   12 ++++--
 6 files changed, 72 insertions(+), 98 deletions(-)

-- 
1.7.7.6



From agordeev at redhat.com  Fri Jan 17 11:02:22 2014
From: agordeev at redhat.com (Alexander Gordeev)
Date: Fri, 17 Jan 2014 17:02:22 +0100
Subject: [PATCH v2 8/9] ath10k: Use pci_enable_msi_range()
In-Reply-To: <cover.1389904166.git.agordeev@redhat.com>
References: <cover.1389904166.git.agordeev@redhat.com>
Message-ID: <ad5cc6d6bdf4c8f5ce4681ec27674d07fbda089e.1389904167.git.agordeev@redhat.com>

As result deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range() and pci_enable_msix_range()
interfaces.

This update also fixes a stylistic (naming and messaging only)
confusion of MSI-X vs multiple MSIs which are not the same.

Signed-off-by: Alexander Gordeev <agordeev at redhat.com>
Acked-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/pci.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 9e86a81..873f50c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2073,14 +2073,14 @@ static void ath10k_pci_tasklet(unsigned long data)
 	}
 }
 
-static int ath10k_pci_start_intr_msix(struct ath10k *ar, int num)
+static int ath10k_pci_start_intr_multi_msi(struct ath10k *ar, int num)
 {
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 	int ret;
 	int i;
 
-	ret = pci_enable_msi_block(ar_pci->pdev, num);
-	if (ret)
+	ret = pci_enable_msi_range(ar_pci->pdev, num, num);
+	if (ret < 0)
 		return ret;
 
 	ret = request_irq(ar_pci->pdev->irq + MSI_ASSIGN_FW,
@@ -2111,11 +2111,11 @@ static int ath10k_pci_start_intr_msix(struct ath10k *ar, int num)
 		}
 	}
 
-	ath10k_info("MSI-X interrupt handling (%d intrs)\n", num);
+	ath10k_info("Multi MSI interrupt handling (%d intrs)\n", num);
 	return 0;
 }
 
-static int ath10k_pci_start_intr_msi(struct ath10k *ar)
+static int ath10k_pci_start_intr_single_msi(struct ath10k *ar)
 {
 	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 	int ret;
@@ -2132,7 +2132,7 @@ static int ath10k_pci_start_intr_msi(struct ath10k *ar)
 		return ret;
 	}
 
-	ath10k_info("MSI interrupt handling\n");
+	ath10k_info("Single MSI interrupt handling\n");
 	return 0;
 }
 
@@ -2199,20 +2199,20 @@ static int ath10k_pci_start_intr(struct ath10k *ar)
 		num = 1;
 
 	if (num > 1) {
-		ret = ath10k_pci_start_intr_msix(ar, num);
+		ret = ath10k_pci_start_intr_multi_msi(ar, num);
 		if (ret == 0)
 			goto exit;
 
-		ath10k_warn("MSI-X didn't succeed (%d), trying MSI\n", ret);
+		ath10k_warn("Multi MSI failed (%d), trying single MSI\n", ret);
 		num = 1;
 	}
 
 	if (num == 1) {
-		ret = ath10k_pci_start_intr_msi(ar);
+		ret = ath10k_pci_start_intr_single_msi(ar);
 		if (ret == 0)
 			goto exit;
 
-		ath10k_warn("MSI didn't succeed (%d), trying legacy INTR\n",
+		ath10k_warn("Single MSI failed (%d), trying legacy INTR\n",
 			    ret);
 		num = 0;
 	}
-- 
1.7.7.6



From janusz.dziedzic at tieto.com  Fri Jan 17 14:04:14 2014
From: janusz.dziedzic at tieto.com (Janusz Dziedzic)
Date: Fri, 17 Jan 2014 20:04:14 +0100
Subject: [PATCH] ath10k: bitrate_mask add force_sgi support
Message-ID: <1389985454-3997-1-git-send-email-janusz.dziedzic@tieto.com>

Add force SGI support.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
depends on, nl80211: add Guard Interval support for set_bitrate_mask

 drivers/net/wireless/ath/ath10k/core.h |    1 +
 drivers/net/wireless/ath/ath10k/mac.c  |   35 +++++++++++++++++++++++++++++---
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ade1781..f0e22c7 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -256,6 +256,7 @@ struct ath10k_vif {
 
 	u8 fixed_rate;
 	u8 fixed_nss;
+	u8 force_sgi;
 };
 
 struct ath10k_vif_iter {
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 70fe386..d1dd59b 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3575,7 +3575,8 @@ static bool ath10k_get_fixed_rate_nss(const struct cfg80211_bitrate_mask *mask,
 
 static int ath10k_set_fixed_rate_param(struct ath10k_vif *arvif,
 				       u8 fixed_rate,
-				       u8 fixed_nss)
+				       u8 fixed_nss,
+				       u8 force_sgi)
 {
 	struct ath10k *ar = arvif->ar;
 	u32 vdev_param;
@@ -3584,12 +3585,16 @@ static int ath10k_set_fixed_rate_param(struct ath10k_vif *arvif,
 	mutex_lock(&ar->conf_mutex);
 
 	if (arvif->fixed_rate == fixed_rate &&
-	    arvif->fixed_nss == fixed_nss)
+	    arvif->fixed_nss == fixed_nss &&
+	    arvif->force_sgi == force_sgi)
 		goto exit;
 
 	if (fixed_rate == WMI_FIXED_RATE_NONE)
 		ath10k_dbg(ATH10K_DBG_MAC, "mac disable fixed bitrate mask\n");
 
+	if (force_sgi)
+		ath10k_dbg(ATH10K_DBG_MAC, "mac force sgi\n");
+
 	vdev_param = ar->wmi.vdev_param->fixed_rate;
 	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
 					vdev_param, fixed_rate);
@@ -3615,6 +3620,19 @@ static int ath10k_set_fixed_rate_param(struct ath10k_vif *arvif,
 
 	arvif->fixed_nss = fixed_nss;
 
+	vdev_param = ar->wmi.vdev_param->sgi;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
+					force_sgi);
+
+	if (ret) {
+		ath10k_warn("Could not set sgi param %d: %d\n",
+			    force_sgi, ret);
+		ret = -EINVAL;
+		goto exit;
+	}
+
+	arvif->force_sgi = force_sgi;
+
 exit:
 	mutex_unlock(&ar->conf_mutex);
 	return ret;
@@ -3629,6 +3647,11 @@ static int ath10k_set_bitrate_mask(struct ieee80211_hw *hw,
 	enum ieee80211_band band = ar->hw->conf.chandef.chan->band;
 	u8 fixed_rate = WMI_FIXED_RATE_NONE;
 	u8 fixed_nss = ar->num_rf_chains;
+	u8 force_sgi;
+
+	force_sgi = mask->control[band].gi;
+	if (force_sgi == NL80211_TXRATE_FORCE_LGI)
+		return -EINVAL;
 
 	if (!ath10k_default_bitrate_mask(ar, band, mask)) {
 		if (!ath10k_get_fixed_rate_nss(mask, band,
@@ -3637,7 +3660,13 @@ static int ath10k_set_bitrate_mask(struct ieee80211_hw *hw,
 			return -EINVAL;
 	}
 
-	return ath10k_set_fixed_rate_param(arvif, fixed_rate, fixed_nss);
+	if (fixed_rate == WMI_FIXED_RATE_NONE && force_sgi) {
+		ath10k_warn("Could not force SGI usage for default rate settings\n");
+		return -EINVAL;
+	}
+
+	return ath10k_set_fixed_rate_param(arvif, fixed_rate,
+					   fixed_nss, force_sgi);
 }
 
 static const struct ieee80211_ops ath10k_ops = {
-- 
1.7.9.5



From bhelgaas at google.com  Fri Jan 17 16:00:32 2014
From: bhelgaas at google.com (Bjorn Helgaas)
Date: Fri, 17 Jan 2014 14:00:32 -0700
Subject: [PATCH v2 0/9] Phase out pci_enable_msi_block()
In-Reply-To: <cover.1389904166.git.agordeev@redhat.com>
References: <cover.1389904166.git.agordeev@redhat.com>
Message-ID: <CAErSpo5ztnyyceeN38XzLasLV6eJqdbqEV0viPp3Af8U=ts23w@mail.gmail.com>

On Fri, Jan 17, 2014 at 9:02 AM, Alexander Gordeev <agordeev at redhat.com> wrote:
> This series is against "next" branch in Bjorn's repo:
> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
>
> Changes from v1 to v2:
>   - added a regression fix "ahci: Fix broken fallback to single
>     MSI mode" as patch 1/9;
>   - the series is reordered to move the regression fix in front;
>   - at Bjorn's request pci_enable_msi() is un-deprecated;
>   - as result, pci_enable_msi_range(pdev, 1, 1) styled calls
>     rolled back to pci_enable_msi(pdev);
>   - nvme bug fix moved out as a separate patch 5/9 "nvme: Fix
>     invalid call to irq_set_affinity_hint()"
>   - patches changelog elaborated a bit;
>
> Bjorn,
>
> As the release is supposedly this weekend, do you prefer
> the patches to go to your tree or to individual trees after
> the release?

I'd be happy to merge them, except for the fact that they probably
wouldn't have any time in -next before I ask Linus to pull them.  So
how about if we wait until after the release, ask the area maintainers
to take them, and if they don't take them, I'll put them in my tree
for v3.15?

Bjorn


From agordeev at redhat.com  Sat Jan 18 02:15:38 2014
From: agordeev at redhat.com (Alexander Gordeev)
Date: Sat, 18 Jan 2014 08:15:38 +0100
Subject: [PATCH v2 0/9] Phase out pci_enable_msi_block()
In-Reply-To: <CAErSpo5ztnyyceeN38XzLasLV6eJqdbqEV0viPp3Af8U=ts23w@mail.gmail.com>
References: <cover.1389904166.git.agordeev@redhat.com>
 <CAErSpo5ztnyyceeN38XzLasLV6eJqdbqEV0viPp3Af8U=ts23w@mail.gmail.com>
Message-ID: <20140118071538.GA32535@dhcp-26-207.brq.redhat.com>

On Fri, Jan 17, 2014 at 02:00:32PM -0700, Bjorn Helgaas wrote:
> > As the release is supposedly this weekend, do you prefer
> > the patches to go to your tree or to individual trees after
> > the release?
> 
> I'd be happy to merge them, except for the fact that they probably
> wouldn't have any time in -next before I ask Linus to pull them.  So
> how about if we wait until after the release, ask the area maintainers
> to take them, and if they don't take them, I'll put them in my tree
> for v3.15?

Patch 11 depends on patches 1-10, so I am not sure how to better handle it.
Whatever works for you ;)

I am only concerned with a regression fix "ahci: Fix broken fallback to
single MSI mode" which would be nice to have in 3.14. But it seems pretty
much too late.

> Bjorn

Thanks!

-- 
Regards,
Alexander Gordeev
agordeev at redhat.com


From kvalo at qca.qualcomm.com  Sat Jan 18 03:43:48 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Sat, 18 Jan 2014 10:43:48 +0200
Subject: [PATCH] ath10k: bitrate_mask add force_sgi support
In-Reply-To: <1389985454-3997-1-git-send-email-janusz.dziedzic@tieto.com>
 (Janusz Dziedzic's message of "Fri, 17 Jan 2014 20:04:14 +0100")
References: <1389985454-3997-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <87r485ptmj.fsf@kamboji.qca.qualcomm.com>

Janusz Dziedzic <janusz.dziedzic at tieto.com> writes:

> Add force SGI support.
>
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>

Thanks, the patch looks good.

> depends on, nl80211: add Guard Interval support for set_bitrate_mask

But I can only apply this only once the dependency patch goes to
wireless-next, so I'll keep this in my pending queue until that happens.
Most likely we need to wait for the merge window to close.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Sat Jan 18 04:05:20 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Sat, 18 Jan 2014 11:05:20 +0200
Subject: [PATCH 0/2] Initial 11ac support using ath10k
In-Reply-To: <1513091.zjVOOQ7NvD@bentobox> (Sven Eckelmann's message of "Thu, 
 16 Jan 2014 11:47:06 +0100")
References: <1513091.zjVOOQ7NvD@bentobox>
Message-ID: <87mwitpsmn.fsf@kamboji.qca.qualcomm.com>

Hi Sven,

adding ath10k at lists.infradead.org.

Sven Eckelmann <sven at open-mesh.com> writes:

> Hi,
>
> support for ath10k cards was added a while ago to OpenWrt. Unfortunately, the 
> actual 802.11ac support was never added (patches on the mailing lists were 
> just ignored). This is a rather unpleasant situation when trying to get some 
> 11ac test hardware working.

Yeah, it would be great to get proper ath10k support to OpenWrt. Thanks
for working on this!

> I've picked up the patches and rebased them on top of the current master 
> branch/trunk.

Where did you take the ath10k patches? ath10k is under heavy
development, so I strongly recommend taking patches directly from
ath-next branch of my ath.git. That way you would be using the latest
and greatest.

> Just as general information to the state of ath10k, my current test showed 
> some problems with it:
>
>  * Samsung GT-I9300 only got horrible slow connections to an QCA9880 but
>    an Intel N6205 (using iwlwifi from v3.12) or Samsung S4 worked
>    "fine"

Could you report the I9300 issue to the ath10k list with more details,
please? We can try to investigate it.

>  * Adhoc mode doesn't work at all

That was with 10.1 firmware? AFAIK it doesn't support adhoc at all. I
think we need to add a firmware feature flag to disable adhoc with that
firmware.

>  * TX bitrate information is bogus (iw XXX station dump)

Yeah, this is annoying. But firmware doesn't report this to the host at
all so there is not much ath10k can do right now. But I'll send a query
to the firmware team if they could provide that information to ath10k.

>  * Crashed relative often on reconfiguration:
>    Data bus error, epc 87b7a864, ra 87b7a864

On some QCA988x boards cold reset seems to cause problems on the PCI
bus. We are investigating this.

>  * Sometimes adding of station seems to fail:
>    ath10k: Failed to add peer 5c:0a:5b:4e:6a:c4 for vdev 1 when adding a new
>    sta: -145

This is new to me. Can you report this to the ath10k list, please?

>  * Adhoc interface +  "iw dev wlan0 scan trigger" just crashes the firmware:
>    [ 296.160000] ath10k: firmware crashed!
>    [ 296.170000] ath10k: hardware name qca988x hw2.0 version 0x4100016c
>    [ 296.170000] ath10k: firmware version: 65.467.0.0

What firmware version was this? The version printed here seems to be
corrupted.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Sat Jan 18 04:14:28 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Sat, 18 Jan 2014 11:14:28 +0200
Subject: [PATCH 0/2] Initial 11ac support using ath10k
In-Reply-To: <87mwitpsmn.fsf@kamboji.qca.qualcomm.com> (Kalle Valo's message
 of "Sat, 18 Jan 2014 11:05:20 +0200")
References: <1513091.zjVOOQ7NvD@bentobox>
 <87mwitpsmn.fsf@kamboji.qca.qualcomm.com>
Message-ID: <878uudps7f.fsf@kamboji.qca.qualcomm.com>

(resending my mail due to a stupid rule in ath10k-devel, I need to be
subcribed before posting to that list)

Hi Sven,

adding ath10k at lists.infradead.org.

Sven Eckelmann <sven at open-mesh.com> writes:

> Hi,
>
> support for ath10k cards was added a while ago to OpenWrt. Unfortunately, the 
> actual 802.11ac support was never added (patches on the mailing lists were 
> just ignored). This is a rather unpleasant situation when trying to get some 
> 11ac test hardware working.

Yeah, it would be great to get proper ath10k support to OpenWrt. Thanks
for working on this!

> I've picked up the patches and rebased them on top of the current master 
> branch/trunk.

Where did you take the ath10k patches? ath10k is under heavy
development, so I strongly recommend taking patches directly from
ath-next branch of my ath.git. That way you would be using the latest
and greatest.

> Just as general information to the state of ath10k, my current test showed 
> some problems with it:
>
>  * Samsung GT-I9300 only got horrible slow connections to an QCA9880 but
>    an Intel N6205 (using iwlwifi from v3.12) or Samsung S4 worked
>    "fine"

Could you report the I9300 issue to the ath10k list with more details,
please? We can try to investigate it.

>  * Adhoc mode doesn't work at all

That was with 10.1 firmware? AFAIK it doesn't support adhoc at all. I
think we need to add a firmware feature flag to disable adhoc with that
firmware.

>  * TX bitrate information is bogus (iw XXX station dump)

Yeah, this is annoying. But firmware doesn't report this to the host at
all so there is not much ath10k can do right now. But I'll send a query
to the firmware team if they could provide that information to ath10k.

>  * Crashed relative often on reconfiguration:
>    Data bus error, epc 87b7a864, ra 87b7a864

On some QCA988x boards cold reset seems to cause problems on the PCI
bus. We are investigating this.

>  * Sometimes adding of station seems to fail:
>    ath10k: Failed to add peer 5c:0a:5b:4e:6a:c4 for vdev 1 when adding a new
>    sta: -145

This is new to me. Can you report this to the ath10k list, please?

>  * Adhoc interface +  "iw dev wlan0 scan trigger" just crashes the firmware:
>    [ 296.160000] ath10k: firmware crashed!
>    [ 296.170000] ath10k: hardware name qca988x hw2.0 version 0x4100016c
>    [ 296.170000] ath10k: firmware version: 65.467.0.0

What firmware version was this? The version printed here seems to be
corrupted.

-- 
Kalle Valo


From yeohchunyeow at gmail.com  Sat Jan 18 04:53:18 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Sat, 18 Jan 2014 17:53:18 +0800
Subject: [PATCH v2] ath10k: fix the MAC address of peer statistic
In-Reply-To: <87d2jqrajq.fsf@kamboji.qca.qualcomm.com>
References: <1389345564-21042-1-git-send-email-yeohchunyeow@gmail.com>
 <CA+BoTQmexjQy-+Bv-uofBa2Ndcu56yYOAEeNzdBSE3yMCQdZKw@mail.gmail.com>
 <87d2jqrajq.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CAEFj984ojBbfsMVi3VCQYcRqk2rMz+sq_MaH9JbDsuEmks0DTQ@mail.gmail.com>

> This reminds me that Bartosz sent something related to this few months back:
>
> http://lists.infradead.org/pipermail/ath10k/2013-September/000317.html
>

Thanks, Michal and Kalle Valo for both your comments

I just would like to know which version of firmware should we use?

----
Chun-Yeow


From kvalo at qca.qualcomm.com  Sat Jan 18 05:05:29 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Sat, 18 Jan 2014 12:05:29 +0200
Subject: [PATCH v2] ath10k: fix the MAC address of peer statistic
In-Reply-To: <CAEFj984ojBbfsMVi3VCQYcRqk2rMz+sq_MaH9JbDsuEmks0DTQ@mail.gmail.com>
 (Yeoh Chun-Yeow's message of "Sat, 18 Jan 2014 17:53:18 +0800")
References: <1389345564-21042-1-git-send-email-yeohchunyeow@gmail.com>
 <CA+BoTQmexjQy-+Bv-uofBa2Ndcu56yYOAEeNzdBSE3yMCQdZKw@mail.gmail.com>
 <87d2jqrajq.fsf@kamboji.qca.qualcomm.com>
 <CAEFj984ojBbfsMVi3VCQYcRqk2rMz+sq_MaH9JbDsuEmks0DTQ@mail.gmail.com>
Message-ID: <878uudob9y.fsf@kamboji.qca.qualcomm.com>

Yeoh Chun-Yeow <yeohchunyeow at gmail.com> writes:

>> This reminds me that Bartosz sent something related to this few months back:
>>
>> http://lists.infradead.org/pipermail/ath10k/2013-September/000317.html
>>
>
> Thanks, Michal and Kalle Valo for both your comments
>
> I just would like to know which version of firmware should we use?

It depends what you want to do. 10.1 firmare supports AP mode best, but
other modes are not supported or are otherwise buggy.

The main firmware "999.x" supports all modes, but AP mode support is not
that good as in 10.1.

-- 
Kalle Valo


From bhelgaas at google.com  Sat Jan 18 09:38:55 2014
From: bhelgaas at google.com (Bjorn Helgaas)
Date: Sat, 18 Jan 2014 07:38:55 -0700
Subject: [PATCH v2 0/9] Phase out pci_enable_msi_block()
In-Reply-To: <20140118071538.GA32535@dhcp-26-207.brq.redhat.com>
References: <cover.1389904166.git.agordeev@redhat.com>
 <CAErSpo5ztnyyceeN38XzLasLV6eJqdbqEV0viPp3Af8U=ts23w@mail.gmail.com>
 <20140118071538.GA32535@dhcp-26-207.brq.redhat.com>
Message-ID: <CAErSpo4nBdnn3YYaLj6QZ8iyY2pzV8Y7msd5UxJXm1T2AYnqfg@mail.gmail.com>

On Sat, Jan 18, 2014 at 12:15 AM, Alexander Gordeev <agordeev at redhat.com> wrote:
> On Fri, Jan 17, 2014 at 02:00:32PM -0700, Bjorn Helgaas wrote:
>> > As the release is supposedly this weekend, do you prefer
>> > the patches to go to your tree or to individual trees after
>> > the release?
>>
>> I'd be happy to merge them, except for the fact that they probably
>> wouldn't have any time in -next before I ask Linus to pull them.  So
>> how about if we wait until after the release, ask the area maintainers
>> to take them, and if they don't take them, I'll put them in my tree
>> for v3.15?
>
> Patch 11 depends on patches 1-10, so I am not sure how to better handle it.
> Whatever works for you ;)
>
> I am only concerned with a regression fix "ahci: Fix broken fallback to
> single MSI mode" which would be nice to have in 3.14. But it seems pretty
> much too late.

Tejun, if you want to ack that one, I can put it in either the first
3.14 pull request or a subsequent one.  Either way, since it's a
regression fix, we should be able to get it in 3.14.

Bjorn


From tj at kernel.org  Sat Jan 18 09:59:40 2014
From: tj at kernel.org (Tejun Heo)
Date: Sat, 18 Jan 2014 09:59:40 -0500
Subject: [PATCH v2 0/9] Phase out pci_enable_msi_block()
In-Reply-To: <CAErSpo4nBdnn3YYaLj6QZ8iyY2pzV8Y7msd5UxJXm1T2AYnqfg@mail.gmail.com>
References: <cover.1389904166.git.agordeev@redhat.com>
 <CAErSpo5ztnyyceeN38XzLasLV6eJqdbqEV0viPp3Af8U=ts23w@mail.gmail.com>
 <20140118071538.GA32535@dhcp-26-207.brq.redhat.com>
 <CAErSpo4nBdnn3YYaLj6QZ8iyY2pzV8Y7msd5UxJXm1T2AYnqfg@mail.gmail.com>
Message-ID: <20140118145940.GE3640@htj.dyndns.org>

On Sat, Jan 18, 2014 at 07:38:55AM -0700, Bjorn Helgaas wrote:
> On Sat, Jan 18, 2014 at 12:15 AM, Alexander Gordeev <agordeev at redhat.com> wrote:
> > On Fri, Jan 17, 2014 at 02:00:32PM -0700, Bjorn Helgaas wrote:
> >> > As the release is supposedly this weekend, do you prefer
> >> > the patches to go to your tree or to individual trees after
> >> > the release?
> >>
> >> I'd be happy to merge them, except for the fact that they probably
> >> wouldn't have any time in -next before I ask Linus to pull them.  So
> >> how about if we wait until after the release, ask the area maintainers
> >> to take them, and if they don't take them, I'll put them in my tree
> >> for v3.15?
> >
> > Patch 11 depends on patches 1-10, so I am not sure how to better handle it.
> > Whatever works for you ;)
> >
> > I am only concerned with a regression fix "ahci: Fix broken fallback to
> > single MSI mode" which would be nice to have in 3.14. But it seems pretty
> > much too late.
> 
> Tejun, if you want to ack that one, I can put it in either the first
> 3.14 pull request or a subsequent one.  Either way, since it's a
> regression fix, we should be able to get it in 3.14.

Acked-by: Tejun Heo <tj at kernel.org>

Please feel free to route it any way you see fit.

Thanks!

-- 
tejun


From kvalo at qca.qualcomm.com  Mon Jan 20 04:01:46 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 20 Jan 2014 11:01:46 +0200
Subject: [PATCH v2] ath10k: enable firmware STA quick kickout
Message-ID: <20140120090146.5500.12995.stgit@potku.adurom.net>

Firmware has a feature to track if the associated STA is not acking the frames.
When that happens, the firmware sends WMI_PEER_STA_KICKOUT_EVENTID event to the
host. Enable that to faster detect when a STA has left BSS without sending a
deauth frame.

Also set huge keepalive timeouts to avoid using the keepalive functionality in
the firmware.

Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.h |   12 +++++++
 drivers/net/wireless/ath/ath10k/mac.c  |   58 ++++++++++++++++++++++++++++----
 drivers/net/wireless/ath/ath10k/wmi.c  |   22 ++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h  |    4 ++
 4 files changed, 88 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ade1781..e6308f4 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -46,6 +46,18 @@
 
 #define ATH10K_MAX_NUM_MGMT_PENDING 128
 
+/* number of failed packets */
+#define ATH10K_KICKOUT_THRESHOLD 50
+
+/*
+ * Use insanely high numbers to make sure that the firmware implementation
+ * won't start, we have the same functionality already in hostapd. Unit
+ * is seconds.
+ */
+#define ATH10K_KEEPALIVE_MIN_IDLE 3747
+#define ATH10K_KEEPALIVE_MAX_IDLE 3895
+#define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
+
 struct ath10k;
 
 struct ath10k_skb_cb {
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 7aa6c4d..9f90816 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -339,6 +339,50 @@ static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr)
 	return 0;
 }
 
+static int ath10k_mac_set_kickout(struct ath10k_vif *arvif)
+{
+	struct ath10k *ar = arvif->ar;
+	u32 param;
+	int ret;
+
+	param = ar->wmi.pdev_param->sta_kickout_th;
+	ret = ath10k_wmi_pdev_set_param(ar, param,
+					ATH10K_KICKOUT_THRESHOLD);
+	if (ret) {
+		ath10k_warn("Failed to set kickout threshold: %d\n", ret);
+		return ret;
+	}
+
+	param = ar->wmi.vdev_param->ap_keepalive_min_idle_inactive_time_secs;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
+					ATH10K_KEEPALIVE_MIN_IDLE);
+	if (ret) {
+		ath10k_warn("Failed to set keepalive minimum idle time : %d\n",
+			    ret);
+		return ret;
+	}
+
+	param = ar->wmi.vdev_param->ap_keepalive_max_idle_inactive_time_secs;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
+					ATH10K_KEEPALIVE_MAX_IDLE);
+	if (ret) {
+		ath10k_warn("Failed to set keepalive maximum idle time: %d\n",
+			    ret);
+		return ret;
+	}
+
+	param = ar->wmi.vdev_param->ap_keepalive_max_unresponsive_time_secs;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param,
+					ATH10K_KEEPALIVE_MAX_UNRESPONSIVE);
+	if (ret) {
+		ath10k_warn("Failed to set keepalive maximum unresponsive time: %d\n",
+			    ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 static int  ath10k_mac_set_rts(struct ath10k_vif *arvif, u32 value)
 {
 	struct ath10k *ar = arvif->ar;
@@ -2214,7 +2258,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
 	enum wmi_sta_powersave_param param;
 	int ret = 0;
-	u32 value, param_id;
+	u32 value;
 	int bit;
 	u32 vdev_param;
 
@@ -2307,12 +2351,12 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 			goto err_vdev_delete;
 		}
 
-		param_id = ar->wmi.pdev_param->sta_kickout_th;
-
-		/* Disable STA KICKOUT functionality in FW */
-		ret = ath10k_wmi_pdev_set_param(ar, param_id, 0);
-		if (ret)
-			ath10k_warn("Failed to disable STA KICKOUT\n");
+		ret = ath10k_mac_set_kickout(arvif);
+		if (ret) {
+			ath10k_warn("Failed to set kickout parameters: %d\n",
+				    ret);
+			goto err_peer_delete;
+		}
 	}
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 712a606..0bc8543 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1116,7 +1116,27 @@ static void ath10k_wmi_event_vdev_stopped(struct ath10k *ar,
 static void ath10k_wmi_event_peer_sta_kickout(struct ath10k *ar,
 					      struct sk_buff *skb)
 {
-	ath10k_dbg(ATH10K_DBG_WMI, "WMI_PEER_STA_KICKOUT_EVENTID\n");
+	struct wmi_peer_sta_kickout_event *ev;
+	struct ieee80211_sta *sta;
+
+	ev = (struct wmi_peer_sta_kickout_event *)skb->data;
+
+	ath10k_dbg(ATH10K_DBG_WMI, "wmi event peer sta kickout %pM\n",
+		   ev->peer_macaddr.addr);
+
+	rcu_read_lock();
+
+	sta = ieee80211_find_sta_by_ifaddr(ar->hw, ev->peer_macaddr.addr, NULL);
+	if (!sta) {
+		ath10k_warn("Spurious quick kickout for STA %pM\n",
+			    ev->peer_macaddr.addr);
+		goto exit;
+	}
+
+	ieee80211_report_low_ack(sta, 10);
+
+exit:
+	rcu_read_unlock();
 }
 
 /*
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 4b5e7d3..9dc90c5 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -4039,6 +4039,10 @@ struct wmi_chan_info_event {
 	__le32 cycle_count;
 } __packed;
 
+struct wmi_peer_sta_kickout_event {
+	struct wmi_mac_addr peer_macaddr;
+} __packed;
+
 #define WMI_CHAN_INFO_FLAG_COMPLETE BIT(0)
 
 /* FIXME: empirically extrapolated */



From kvalo at qca.qualcomm.com  Mon Jan 20 04:08:12 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 20 Jan 2014 11:08:12 +0200
Subject: [PATCH v2] ath10k: enable firmware STA quick kickout
In-Reply-To: <20140120090146.5500.12995.stgit@potku.adurom.net> (Kalle Valo's
 message of "Mon, 20 Jan 2014 11:01:46 +0200")
References: <20140120090146.5500.12995.stgit@potku.adurom.net>
Message-ID: <87sisjkolf.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> Firmware has a feature to track if the associated STA is not acking the frames.
> When that happens, the firmware sends WMI_PEER_STA_KICKOUT_EVENTID event to the
> host. Enable that to faster detect when a STA has left BSS without sending a
> deauth frame.
>
> Also set huge keepalive timeouts to avoid using the keepalive functionality in
> the firmware.
>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

In this v2 I fixed the warning messages.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Mon Jan 20 04:20:11 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 20 Jan 2014 11:20:11 +0200
Subject: [PATCH] ath10k: enable wmi ps peer param command for 10.x FW
In-Reply-To: <1389964088-4458-1-git-send-email-janusz.dziedzic@tieto.com>
 (Janusz Dziedzic's message of "Fri, 17 Jan 2014 14:08:08 +0100")
References: <1389964088-4458-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <87k3dvko1g.fsf@kamboji.qca.qualcomm.com>

Janusz Dziedzic <janusz.dziedzic at tieto.com> writes:

> Enable ap_ps_peer_param_cmdid for 10.x FW.
> This is used mainly for AP UAPSD.
>
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>

Thanks, applied.

-- 
Kalle Valo


From yeohchunyeow at gmail.com  Mon Jan 20 04:33:20 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Mon, 20 Jan 2014 17:33:20 +0800
Subject: [PATCH 0/2] Initial 11ac support using ath10k
In-Reply-To: <878uudps7f.fsf@kamboji.qca.qualcomm.com>
References: <1513091.zjVOOQ7NvD@bentobox>
 <87mwitpsmn.fsf@kamboji.qca.qualcomm.com>
 <878uudps7f.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CAEFj986qG4tfbzsgN6b1+0dh5SAP61-aU_Oc3YQLJPU5a8LX-g@mail.gmail.com>

>>  * Adhoc mode doesn't work at all
>
> That was with 10.1 firmware? AFAIK it doesn't support adhoc at all. I
> think we need to add a firmware feature flag to disable adhoc with that
> firmware.

I managed to try out the firmware version 999.999.0.636 on adhoc mode.
It works only after I fool the drv_get_tsf (currently not implemented
in ath10k) to return 0.

Also, the firmware seems only allow the legacy rate and not HT/VHT
rate in adhoc mode. FYI, drv_sta_rc_update also not implemented in
ath10k.

Let me know if you have any updates. Thanks

----
Chun-Yeow


From sven at open-mesh.com  Mon Jan 20 05:29:26 2014
From: sven at open-mesh.com (Sven Eckelmann)
Date: Mon, 20 Jan 2014 11:29:26 +0100
Subject: [PATCH 0/2] Initial 11ac support using ath10k
In-Reply-To: <878uudps7f.fsf@kamboji.qca.qualcomm.com>
References: <1513091.zjVOOQ7NvD@bentobox>
 <87mwitpsmn.fsf@kamboji.qca.qualcomm.com>
 <878uudps7f.fsf@kamboji.qca.qualcomm.com>
Message-ID: <2241060.ARHWKI05xP@bentobox>

On Saturday 18 January 2014 01:14:28 Kalle Valo wrote:
> > I've picked up the patches and rebased them on top of the current master
> > branch/trunk.
> 
> Where did you take the ath10k patches? ath10k is under heavy
> development, so I strongly recommend taking patches directly from
> ath-next branch of my ath.git. That way you would be using the latest
> and greatest.

They were taken from the wireless-testing repo. But it seems that (for obvious 
reasons) the OpenWrt maintainers doesn't want so apply so many patches. But it 
is a good source [1] for future tests.

> > Just as general information to the state of ath10k, my current test showed
> > 
> > some problems with it:
> >  * Samsung GT-I9300 only got horrible slow connections to an QCA9880 but
> >  
> >    an Intel N6205 (using iwlwifi from v3.12) or Samsung S4 worked
> >    "fine"
> 
> Could you report the I9300 issue to the ath10k list with more details,
> please? We can try to investigate it.

This is a little bit problematic. I could reproduce this problem quite well on 
a specific date and when I tried some other day it worked fine. So it is hard 
to report anything. The only thing I could report would be the "Failed to add 
peer" problem which seemed to happen at the same time.

Maybe I find a way to reproduce it reliable but I don't know how at the 
moment.

> >  * Adhoc mode doesn't work at all
> 
> That was with 10.1 firmware? AFAIK it doesn't support adhoc at all. I
> think we need to add a firmware feature flag to disable adhoc with that
> firmware.

It used the latest and greatest, stable(?) version of the firmware when the 
patchset was generated: ap/firmware-2.bin_10.1.467-1

The statement "doesn't support adhoc at all" makes me a little bit nervous. 
Would you say that it is better to completely ignore the "ap" directory of the 
firmware repo [2]? Which benefits does the ap firmware has over the ath10k 
firmware?

At the end I would most likely run something like this:

 * 1 AP dev with WPA (1/2, TKIP and/or CCMP, PSK or Enterprise)
 * 1 AP dev without WPA
 * 1 adhoc dev with IBSS RSN (running something like batman-adv over
   infrastructure mode is a little bit lame ;) )

But it also has to be able to use a dev in managed mode.

This worked quite well in the past with ath9k and thus I was checking ath10k 
to decide if it is an interesting platform/driver for the future.

> >  * Sometimes adding of station seems to fail:
> >    ath10k: Failed to add peer 5c:0a:5b:4e:6a:c4 for vdev 1 when adding a
> >    new
> >    sta: -145
> 
> This is new to me. Can you report this to the ath10k list, please?

I will try to reproduce it and report it in a separate thread when I have more 
useful information.

> >  * Adhoc interface +  "iw dev wlan0 scan trigger" just crashes the 
firmware:
> >    [ 296.160000] ath10k: firmware crashed!
> >    [ 296.170000] ath10k: hardware name qca988x hw2.0 version 0x4100016c
> >    [ 296.170000] ath10k: firmware version: 65.467.0.0
> 
> What firmware version was this? The version printed here seems to be
> corrupted.

ap/firmware-2.bin_10.1.467-1

Kind regards,
	Sven

[1] https://github.com/kvalo/ath
[2] https://github.com/kvalo/ath10k-firmware
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/ath10k/attachments/20140120/48d6756d/attachment.sig>

From janusz.dziedzic at tieto.com  Mon Jan 20 11:20:20 2014
From: janusz.dziedzic at tieto.com (Janusz Dziedzic)
Date: Mon, 20 Jan 2014 17:20:20 +0100
Subject: [PATCH] ath10k: AP mode, set UAPSD params correctly
Message-ID: <1390234821-4405-1-git-send-email-janusz.dziedzic@tieto.com>

Move UAPSD params settings after peer assoc
command. This is required to setup UAPSD
params correctly.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   80 +++++++++++++++++++--------------
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 70fe386..fda146b 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1092,27 +1092,20 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
 		   arg->peer_num_spatial_streams);
 }
 
-static void ath10k_peer_assoc_h_qos_ap(struct ath10k *ar,
-				       struct ath10k_vif *arvif,
-				       struct ieee80211_sta *sta,
-				       struct ieee80211_bss_conf *bss_conf,
-				       struct wmi_peer_assoc_complete_arg *arg)
+static int ath10k_peer_assoc_qos_ap(struct ath10k *ar,
+				    struct ath10k_vif *arvif,
+				    struct ieee80211_sta *sta)
 {
 	u32 uapsd = 0;
 	u32 max_sp = 0;
+	int ret = 0;
 
 	lockdep_assert_held(&ar->conf_mutex);
 
-	if (sta->wme)
-		arg->peer_flags |= WMI_PEER_QOS;
-
 	if (sta->wme && sta->uapsd_queues) {
 		ath10k_dbg(ATH10K_DBG_MAC, "mac uapsd_queues 0x%x max_sp %d\n",
 			   sta->uapsd_queues, sta->max_sp);
 
-		arg->peer_flags |= WMI_PEER_APSD;
-		arg->peer_rate_caps |= WMI_RC_UAPSD_FLAG;
-
 		if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
 			uapsd |= WMI_AP_PS_UAPSD_AC3_DELIVERY_EN |
 				 WMI_AP_PS_UAPSD_AC3_TRIGGER_EN;
@@ -1130,35 +1123,40 @@ static void ath10k_peer_assoc_h_qos_ap(struct ath10k *ar,
 		if (sta->max_sp < MAX_WMI_AP_PS_PEER_PARAM_MAX_SP)
 			max_sp = sta->max_sp;
 
-		ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
-					   sta->addr,
-					   WMI_AP_PS_PEER_PARAM_UAPSD,
-					   uapsd);
+		ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
+						 sta->addr,
+						 WMI_AP_PS_PEER_PARAM_UAPSD,
+						 uapsd);
+		if (ret) {
+			ath10k_warn("failed to set ap ps peer param uapsd: %d\n",
+				    ret);
+			return ret;
+		}
 
-		ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
-					   sta->addr,
-					   WMI_AP_PS_PEER_PARAM_MAX_SP,
-					   max_sp);
+		ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
+						 sta->addr,
+						 WMI_AP_PS_PEER_PARAM_MAX_SP,
+						 max_sp);
+		if (ret) {
+			ath10k_warn("failed to set ap ps peer param max sp: %d\n",
+				    ret);
+			return ret;
+		}
 
 		/* TODO setup this based on STA listen interval and
 		   beacon interval. Currently we don't know
 		   sta->listen_interval - mac80211 patch required.
 		   Currently use 10 seconds */
-		ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
-					   sta->addr,
-					   WMI_AP_PS_PEER_PARAM_AGEOUT_TIME,
-					   10);
+		ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, sta->addr,
+					WMI_AP_PS_PEER_PARAM_AGEOUT_TIME, 10);
+		if (ret) {
+			ath10k_warn("failed to set ap ps peer param ageout time: %d\n",
+				    ret);
+			return ret;
+		}
 	}
-}
 
-static void ath10k_peer_assoc_h_qos_sta(struct ath10k *ar,
-					struct ath10k_vif *arvif,
-					struct ieee80211_sta *sta,
-					struct ieee80211_bss_conf *bss_conf,
-					struct wmi_peer_assoc_complete_arg *arg)
-{
-	if (bss_conf->qos)
-		arg->peer_flags |= WMI_PEER_QOS;
+	return 0;
 }
 
 static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
@@ -1211,10 +1209,17 @@ static void ath10k_peer_assoc_h_qos(struct ath10k *ar,
 {
 	switch (arvif->vdev_type) {
 	case WMI_VDEV_TYPE_AP:
-		ath10k_peer_assoc_h_qos_ap(ar, arvif, sta, bss_conf, arg);
+		if (sta->wme)
+			arg->peer_flags |= WMI_PEER_QOS;
+
+		if (sta->wme && sta->uapsd_queues) {
+			arg->peer_flags |= WMI_PEER_APSD;
+			arg->peer_rate_caps |= WMI_RC_UAPSD_FLAG;
+		}
 		break;
 	case WMI_VDEV_TYPE_STA:
-		ath10k_peer_assoc_h_qos_sta(ar, arvif, sta, bss_conf, arg);
+		if (bss_conf->qos)
+			arg->peer_flags |= WMI_PEER_QOS;
 		break;
 	default:
 		break;
@@ -1412,6 +1417,13 @@ static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif,
 		return ret;
 	}
 
+	ret = ath10k_peer_assoc_qos_ap(ar, arvif, sta);
+	if (ret) {
+		ath10k_warn("could not set qos params for STA %pM, %d\n",
+			    sta->addr, ret);
+		return ret;
+	}
+
 	return ret;
 }
 
-- 
1.7.9.5



From kvalo at qca.qualcomm.com  Mon Jan 20 11:59:46 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 20 Jan 2014 18:59:46 +0200
Subject: [PATCH] ath10k: AP mode, set UAPSD params correctly
In-Reply-To: <1390234821-4405-1-git-send-email-janusz.dziedzic@tieto.com>
 (Janusz Dziedzic's message of "Mon, 20 Jan 2014 17:20:20 +0100")
References: <1390234821-4405-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <8738kilhbx.fsf@kamboji.qca.qualcomm.com>

Janusz Dziedzic <janusz.dziedzic at tieto.com> writes:

> Move UAPSD params settings after peer assoc
> command. This is required to setup UAPSD
> params correctly.
>
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>

This is a pretty vague description. What is correct today can be totally
wrong tomorrow :)

So I would prefer that you describe a bit more about this change. At
least describe the bug you are fixing (or mention the motivation behind
the change).

-- 
Kalle Valo


From janusz.dziedzic at tieto.com  Mon Jan 20 13:48:44 2014
From: janusz.dziedzic at tieto.com (Janusz Dziedzic)
Date: Mon, 20 Jan 2014 19:48:44 +0100
Subject: [PATCH] ath10k: AP mode, set UAPSD params correctly
In-Reply-To: <8738kilhbx.fsf@kamboji.qca.qualcomm.com>
References: <1390234821-4405-1-git-send-email-janusz.dziedzic@tieto.com>
 <8738kilhbx.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CALhHN=pTEBd5P-weZSxSou3gQmb=wE4fAHTECU6oJ1PSMvfWoQ@mail.gmail.com>

On 20 January 2014 17:59, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Janusz Dziedzic <janusz.dziedzic at tieto.com> writes:
>
>> Move UAPSD params settings after peer assoc
>> command. This is required to setup UAPSD
>> params correctly.
>>
>> Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
>
> This is a pretty vague description. What is correct today can be totally
> wrong tomorrow :)
>
> So I would prefer that you describe a bit more about this change. At
> least describe the bug you are fixing (or mention the motivation behind
> the change).

ath10k handles UAPSD completly in the firmware.
When works in AP mode we have to configure
UAPSD params for each station. Without this
patch we configure UAPSD params before we
send peer assoc command to the FW, which was
wrong. Next FW didn't know what should be trigger
frame, couse UAPSD didn't work correctly in AP mode.
To configure UAPSD params correctly we have to
send them after peer assoc command.


BR
Janusz


From kvalo at qca.qualcomm.com  Tue Jan 21 00:34:08 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 21 Jan 2014 07:34:08 +0200
Subject: [PATCH] ath10k: AP mode, set UAPSD params correctly
In-Reply-To: <CALhHN=pTEBd5P-weZSxSou3gQmb=wE4fAHTECU6oJ1PSMvfWoQ@mail.gmail.com>
 (Janusz Dziedzic's message of "Mon, 20 Jan 2014 19:48:44 +0100")
References: <1390234821-4405-1-git-send-email-janusz.dziedzic@tieto.com>
 <8738kilhbx.fsf@kamboji.qca.qualcomm.com>
 <CALhHN=pTEBd5P-weZSxSou3gQmb=wE4fAHTECU6oJ1PSMvfWoQ@mail.gmail.com>
Message-ID: <87ppnlkien.fsf@kamboji.qca.qualcomm.com>

Janusz Dziedzic <janusz.dziedzic at tieto.com> writes:

> On 20 January 2014 17:59, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
>> Janusz Dziedzic <janusz.dziedzic at tieto.com> writes:
>>
>>> Move UAPSD params settings after peer assoc
>>> command. This is required to setup UAPSD
>>> params correctly.
>>>
>>> Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
>>
>> This is a pretty vague description. What is correct today can be totally
>> wrong tomorrow :)
>>
>> So I would prefer that you describe a bit more about this change. At
>> least describe the bug you are fixing (or mention the motivation behind
>> the change).
>
> ath10k handles UAPSD completly in the firmware.
> When works in AP mode we have to configure
> UAPSD params for each station. Without this
> patch we configure UAPSD params before we
> send peer assoc command to the FW, which was
> wrong. Next FW didn't know what should be trigger
> frame, couse UAPSD didn't work correctly in AP mode.
> To configure UAPSD params correctly we have to
> send them after peer assoc command.

This is much better. Can you send v2 with this description, please?

-- 
Kalle Valo


From janusz.dziedzic at tieto.com  Tue Jan 21 01:06:53 2014
From: janusz.dziedzic at tieto.com (Janusz Dziedzic)
Date: Tue, 21 Jan 2014 07:06:53 +0100
Subject: [PATCH v2] ath10k: AP mode, set UAPSD params correctly
Message-ID: <1390284413-2703-1-git-send-email-janusz.dziedzic@tieto.com>

ath10k handles UAPSD completly in the firmware.
When works in AP mode we have to configure
UAPSD params for each station. Without this
patch we configure UAPSD params before we
send peer assoc command to the FW, which was
wrong. Next FW didn't know what should be trigger
frame, couse UAPSD didn't work correctly in AP mode.
To configure UAPSD params correctly we have to
send them after peer assoc command.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   80 +++++++++++++++++++--------------
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 70fe386..fda146b 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1092,27 +1092,20 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
 		   arg->peer_num_spatial_streams);
 }
 
-static void ath10k_peer_assoc_h_qos_ap(struct ath10k *ar,
-				       struct ath10k_vif *arvif,
-				       struct ieee80211_sta *sta,
-				       struct ieee80211_bss_conf *bss_conf,
-				       struct wmi_peer_assoc_complete_arg *arg)
+static int ath10k_peer_assoc_qos_ap(struct ath10k *ar,
+				    struct ath10k_vif *arvif,
+				    struct ieee80211_sta *sta)
 {
 	u32 uapsd = 0;
 	u32 max_sp = 0;
+	int ret = 0;
 
 	lockdep_assert_held(&ar->conf_mutex);
 
-	if (sta->wme)
-		arg->peer_flags |= WMI_PEER_QOS;
-
 	if (sta->wme && sta->uapsd_queues) {
 		ath10k_dbg(ATH10K_DBG_MAC, "mac uapsd_queues 0x%x max_sp %d\n",
 			   sta->uapsd_queues, sta->max_sp);
 
-		arg->peer_flags |= WMI_PEER_APSD;
-		arg->peer_rate_caps |= WMI_RC_UAPSD_FLAG;
-
 		if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
 			uapsd |= WMI_AP_PS_UAPSD_AC3_DELIVERY_EN |
 				 WMI_AP_PS_UAPSD_AC3_TRIGGER_EN;
@@ -1130,35 +1123,40 @@ static void ath10k_peer_assoc_h_qos_ap(struct ath10k *ar,
 		if (sta->max_sp < MAX_WMI_AP_PS_PEER_PARAM_MAX_SP)
 			max_sp = sta->max_sp;
 
-		ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
-					   sta->addr,
-					   WMI_AP_PS_PEER_PARAM_UAPSD,
-					   uapsd);
+		ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
+						 sta->addr,
+						 WMI_AP_PS_PEER_PARAM_UAPSD,
+						 uapsd);
+		if (ret) {
+			ath10k_warn("failed to set ap ps peer param uapsd: %d\n",
+				    ret);
+			return ret;
+		}
 
-		ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
-					   sta->addr,
-					   WMI_AP_PS_PEER_PARAM_MAX_SP,
-					   max_sp);
+		ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
+						 sta->addr,
+						 WMI_AP_PS_PEER_PARAM_MAX_SP,
+						 max_sp);
+		if (ret) {
+			ath10k_warn("failed to set ap ps peer param max sp: %d\n",
+				    ret);
+			return ret;
+		}
 
 		/* TODO setup this based on STA listen interval and
 		   beacon interval. Currently we don't know
 		   sta->listen_interval - mac80211 patch required.
 		   Currently use 10 seconds */
-		ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
-					   sta->addr,
-					   WMI_AP_PS_PEER_PARAM_AGEOUT_TIME,
-					   10);
+		ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, sta->addr,
+					WMI_AP_PS_PEER_PARAM_AGEOUT_TIME, 10);
+		if (ret) {
+			ath10k_warn("failed to set ap ps peer param ageout time: %d\n",
+				    ret);
+			return ret;
+		}
 	}
-}
 
-static void ath10k_peer_assoc_h_qos_sta(struct ath10k *ar,
-					struct ath10k_vif *arvif,
-					struct ieee80211_sta *sta,
-					struct ieee80211_bss_conf *bss_conf,
-					struct wmi_peer_assoc_complete_arg *arg)
-{
-	if (bss_conf->qos)
-		arg->peer_flags |= WMI_PEER_QOS;
+	return 0;
 }
 
 static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
@@ -1211,10 +1209,17 @@ static void ath10k_peer_assoc_h_qos(struct ath10k *ar,
 {
 	switch (arvif->vdev_type) {
 	case WMI_VDEV_TYPE_AP:
-		ath10k_peer_assoc_h_qos_ap(ar, arvif, sta, bss_conf, arg);
+		if (sta->wme)
+			arg->peer_flags |= WMI_PEER_QOS;
+
+		if (sta->wme && sta->uapsd_queues) {
+			arg->peer_flags |= WMI_PEER_APSD;
+			arg->peer_rate_caps |= WMI_RC_UAPSD_FLAG;
+		}
 		break;
 	case WMI_VDEV_TYPE_STA:
-		ath10k_peer_assoc_h_qos_sta(ar, arvif, sta, bss_conf, arg);
+		if (bss_conf->qos)
+			arg->peer_flags |= WMI_PEER_QOS;
 		break;
 	default:
 		break;
@@ -1412,6 +1417,13 @@ static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif,
 		return ret;
 	}
 
+	ret = ath10k_peer_assoc_qos_ap(ar, arvif, sta);
+	if (ret) {
+		ath10k_warn("could not set qos params for STA %pM, %d\n",
+			    sta->addr, ret);
+		return ret;
+	}
+
 	return ret;
 }
 
-- 
1.7.9.5



From yeohchunyeow at gmail.com  Tue Jan 21 04:21:21 2014
From: yeohchunyeow at gmail.com (Chun-Yeow Yeoh)
Date: Tue, 21 Jan 2014 17:21:21 +0800
Subject: [PATCH] ath10k: fix the printing of 10.x FW version when FW crashed
Message-ID: <1390296081-22788-1-git-send-email-yeohchunyeow@gmail.com>

10.x FW has no structure member sw_version_1. Thus,
both fw_version_release and fw_version_build are not
available. The provided fw_version_major is also wrong.
Fix this by using the fw_version from struct wiphy.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow at gmail.com>
---
 drivers/net/wireless/ath/ath10k/pci.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 29fd197..9179c88 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -833,9 +833,7 @@ static void ath10k_pci_hif_dump_area(struct ath10k *ar)
 	ath10k_err("firmware crashed!\n");
 	ath10k_err("hardware name %s version 0x%x\n",
 		   ar->hw_params.name, ar->target_version);
-	ath10k_err("firmware version: %u.%u.%u.%u\n", ar->fw_version_major,
-		   ar->fw_version_minor, ar->fw_version_release,
-		   ar->fw_version_build);
+	ath10k_err("firmware version: %s\n", ar->hw->wiphy->fw_version);
 
 	host_addr = host_interest_item_address(HI_ITEM(hi_failure_state));
 	ret = ath10k_pci_diag_read_mem(ar, host_addr,
-- 
1.7.9.5



From marek.puzyniak at tieto.com  Tue Jan 21 07:27:35 2014
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Tue, 21 Jan 2014 13:27:35 +0100
Subject: [PATCH 0/3] ath10k: fix host corruption
In-Reply-To: <874n68g5td.fsf@kamboji.qca.qualcomm.com>
References: <1386858261-16037-1-git-send-email-michal.kazior@tieto.com>
 <874n68g5td.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CADnKcVhYqO-0+_9rN07YZyinjsfdnNnn8ix8FgX457vUw_TWRQ@mail.gmail.com>

On 16 December 2013 16:43, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Michal Kazior <michal.kazior at tieto.com> writes:
>
>> This patchset aims at fixing (or at least
>> reducing) the frequency of a (apparently) strange
>> HW bug.
>>
>> The bug happens in some workloads with different
>> frequency with different hardware spinoffs. It is
>> triggered by a cold reset after HW/FW has been
>> excercised with some work.
>>
>> On x86 this could be a hang, on AP135 it is a data
>> bus error.
>>
>>
>> Michal Kazior (3):
>>   ath10k: fix device initialization routine
>>   ath10k: zero device DRAM to avoid host hangs
>>   ath10k: zero CE config upon deinit
>
> Let's put these patches on hold for now while we investigate more about
> this problem.
>
> --
> Kalle Valo
>
> _______________________________________________
> ath10k mailing list
> ath10k at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k

Kalle, please drop these patches. There will be new version of this patch-set.

Marek


From greearb at candelatech.com  Wed Jan 22 15:33:44 2014
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 22 Jan 2014 12:33:44 -0800
Subject: BAR error, failed to get chip id.
Message-ID: <52E02B28.6020503@candelatech.com>


I see this fairly often on module reload.  Firmware is modified
by me, based on 10.1.389, so if there are firmware fixes since then
that address this problem I would not know of it.  Kernel is ath-testing,
with some local changes, but nothing pertaining to the pci code.


Kernel 3.13.0-rc8-wl-ath+ on an x86_64 (ttyS0)

ct523-9292 login: ath10k_pci 0000:05:00.0: BAR 0: error updating (0xf4400004 != 0xffffffff)
ath10k_pci 0000:05:00.0: BAR 0: error updating (high 0x000000 != 0xffffffff)
ath10k: Failed to get chip id: -110


After this, it takes a power cycle to get the system working again.

Anyone seen similar?

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From dave.taht at gmail.com  Wed Jan 22 16:49:26 2014
From: dave.taht at gmail.com (Dave Taht)
Date: Wed, 22 Jan 2014 16:49:26 -0500
Subject: BAR error, failed to get chip id.
In-Reply-To: <52E02B28.6020503@candelatech.com>
References: <52E02B28.6020503@candelatech.com>
Message-ID: <CAA93jw7GShkaY_w5gmbyHpO_rEP_j3hfFRbGZhCB6JBqK0VVzw@mail.gmail.com>

On Wed, Jan 22, 2014 at 3:33 PM, Ben Greear <greearb at candelatech.com> wrote:
>
> I see this fairly often on module reload.  Firmware is modified
> by me, based on 10.1.389, so if there are firmware fixes since then
> that address this problem I would not know of it.  Kernel is ath-testing,
> with some local changes, but nothing pertaining to the pci code.

I have had pci issues on an older atom box, not on a newer nuc.

Can try that box again to see what happens.

>
>
> Kernel 3.13.0-rc8-wl-ath+ on an x86_64 (ttyS0)
>
> ct523-9292 login: ath10k_pci 0000:05:00.0: BAR 0: error updating (0xf4400004 != 0xffffffff)
> ath10k_pci 0000:05:00.0: BAR 0: error updating (high 0x000000 != 0xffffffff)
> ath10k: Failed to get chip id: -110
>
>
> After this, it takes a power cycle to get the system working again.
>
> Anyone seen similar?
>
> Thanks,
> Ben
>
> --
> Ben Greear <greearb at candelatech.com>
> Candela Technologies Inc  http://www.candelatech.com
>
>
> _______________________________________________
> ath10k mailing list
> ath10k at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k



-- 
Dave T?ht

Fixing bufferbloat with cerowrt: http://www.teklibre.com/cerowrt/subscribe.html


From greearb at candelatech.com  Wed Jan 22 16:54:39 2014
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 22 Jan 2014 13:54:39 -0800
Subject: BAR error, failed to get chip id.
In-Reply-To: <CAA93jw7GShkaY_w5gmbyHpO_rEP_j3hfFRbGZhCB6JBqK0VVzw@mail.gmail.com>
References: <52E02B28.6020503@candelatech.com>
 <CAA93jw7GShkaY_w5gmbyHpO_rEP_j3hfFRbGZhCB6JBqK0VVzw@mail.gmail.com>
Message-ID: <52E03E1F.8000102@candelatech.com>

On 01/22/2014 01:49 PM, Dave Taht wrote:
> On Wed, Jan 22, 2014 at 3:33 PM, Ben Greear <greearb at candelatech.com> wrote:
>>
>> I see this fairly often on module reload.  Firmware is modified
>> by me, based on 10.1.389, so if there are firmware fixes since then
>> that address this problem I would not know of it.  Kernel is ath-testing,
>> with some local changes, but nothing pertaining to the pci code.
> 
> I have had pci issues on an older atom box, not on a newer nuc.
> 
> Can try that box again to see what happens.

I'm using a core-i7 low-power system...has been rock solid for ath9k for
a long time, for what that is worth.

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Wed Jan 22 19:05:59 2014
From: greearb at candelatech.com (greearb at candelatech.com)
Date: Wed, 22 Jan 2014 16:05:59 -0800
Subject: [PATCH 1/4] ath10k:  Print out firmware feature bits from IE.
Message-ID: <1390435562-15473-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

Aids in understanding excactly what a firmware is
offering.

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 drivers/net/wireless/ath/ath10k/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 3b59af3..56048b1 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -470,8 +470,12 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
 				if (index == ie_len)
 					break;
 
-				if (data[index] & (1 << bit))
+				if (data[index] & (1 << bit)) {
+					ath10k_dbg(ATH10K_DBG_BOOT,
+						   "Enabling feature bit: %i\n",
+						   i);
 					__set_bit(i, ar->fw_features);
+				}
 			}
 
 			ath10k_dbg_dump(ATH10K_DBG_BOOT, "features", "",
-- 
1.7.11.7



From greearb at candelatech.com  Wed Jan 22 19:06:01 2014
From: greearb at candelatech.com (greearb at candelatech.com)
Date: Wed, 22 Jan 2014 16:06:01 -0800
Subject: [PATCH 3/4] ath10k:  Add more debugging for receive errors.
In-Reply-To: <1390435562-15473-1-git-send-email-greearb@candelatech.com>
References: <1390435562-15473-1-git-send-email-greearb@candelatech.com>
Message-ID: <1390435562-15473-3-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 8 ++++++++
 drivers/net/wireless/ath/ath10k/txrx.c   | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index fe8bd1b..49e6c4e 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -937,6 +937,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
 			}
 
 			if (ath10k_htt_rx_has_decrypt_err(msdu_head)) {
+				ath10k_warn("htt rx dropping due to decrypt-err\n");
 				ath10k_htt_rx_free_msdu_chain(msdu_head);
 				continue;
 			}
@@ -975,6 +976,13 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
 			info.skb     = msdu_head;
 			info.fcs_err = ath10k_htt_rx_has_fcs_err(msdu_head);
 			info.mic_err = ath10k_htt_rx_has_mic_err(msdu_head);
+
+			if (info.fcs_err)
+				ath10k_warn("htt rx has FCS err\n");
+
+			if (info.mic_err)
+				ath10k_warn("htt rx has MIC err\n");
+
 			info.signal  = ATH10K_DEFAULT_NOISE_FLOOR;
 			info.signal += rx->ppdu.combined_rssi;
 
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index e404124..fc3a651 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -259,7 +259,7 @@ void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
 	status->freq = ch->center_freq;
 
 	ath10k_dbg(ATH10K_DBG_DATA,
-		   "rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u\n",
+		   "rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag: 0x%x fcs-err: %i\n",
 		   info->skb,
 		   info->skb->len,
 		   status->flag == 0 ? "legacy" : "",
@@ -271,7 +271,7 @@ void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
 		   status->rate_idx,
 		   status->vht_nss,
 		   status->freq,
-		   status->band);
+		   status->band, status->flag, info->fcs_err);
 	ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "rx skb: ",
 			info->skb->data, info->skb->len);
 
-- 
1.7.11.7



From greearb at candelatech.com  Wed Jan 22 19:06:00 2014
From: greearb at candelatech.com (greearb at candelatech.com)
Date: Wed, 22 Jan 2014 16:06:00 -0800
Subject: [PATCH 2/4] ath10k:  Print out size of wmi-ready-event message.
In-Reply-To: <1390435562-15473-1-git-send-email-greearb@candelatech.com>
References: <1390435562-15473-1-git-send-email-greearb@candelatech.com>
Message-ID: <1390435562-15473-2-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 712a606..c99bca6 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2031,11 +2031,11 @@ static int ath10k_wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
 	memcpy(ar->mac_addr, ev->mac_addr.addr, ETH_ALEN);
 
 	ath10k_dbg(ATH10K_DBG_WMI,
-		   "wmi event ready sw_version %u abi_version %u mac_addr %pM status %d\n",
+		   "wmi event ready sw_version %u abi_version %u mac_addr %pM status %d  skb->len: %i  ev-sz: %lu\n",
 		   __le32_to_cpu(ev->sw_version),
 		   __le32_to_cpu(ev->abi_version),
 		   ev->mac_addr.addr,
-		   __le32_to_cpu(ev->status));
+		   __le32_to_cpu(ev->status), skb->len, sizeof(*ev));
 
 	complete(&ar->wmi.unified_ready);
 	return 0;
-- 
1.7.11.7



From greearb at candelatech.com  Wed Jan 22 19:06:02 2014
From: greearb at candelatech.com (greearb at candelatech.com)
Date: Wed, 22 Jan 2014 16:06:02 -0800
Subject: [PATCH 4/4] ath10k:  Better tx/rx debugging.
In-Reply-To: <1390435562-15473-1-git-send-email-greearb@candelatech.com>
References: <1390435562-15473-1-git-send-email-greearb@candelatech.com>
Message-ID: <1390435562-15473-4-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

Make it easier to grep for htt rx errors.

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 18 ++++++++++--------
 drivers/net/wireless/ath/ath10k/htt_tx.c |  4 ++--
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 49e6c4e..7b0b51f 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -324,7 +324,7 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,
 				 msdu->len + skb_tailroom(msdu),
 				 DMA_FROM_DEVICE);
 
-		ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt rx: ",
+		ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt rx pop: ",
 				msdu->data, msdu->len + skb_tailroom(msdu));
 
 		rx_desc = (struct htt_rx_desc *)msdu->data;
@@ -417,8 +417,8 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,
 					 next->len + skb_tailroom(next),
 					 DMA_FROM_DEVICE);
 
-			ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt rx: ",
-					next->data,
+			ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL,
+					"htt rx chained: ", next->data,
 					next->len + skb_tailroom(next));
 
 			skb_trim(next, 0);
@@ -751,7 +751,7 @@ static void ath10k_htt_rx_msdu(struct ath10k_htt *htt, struct htt_rx_info *info)
 
 	/* This shouldn't happen. If it does than it may be a FW bug. */
 	if (skb->next) {
-		ath10k_warn("received chained non A-MSDU frame\n");
+		ath10k_warn("htt rx: received chained non A-MSDU frame\n");
 		ath10k_htt_rx_free_msdu_chain(skb->next);
 		skb->next = NULL;
 	}
@@ -937,7 +937,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
 			}
 
 			if (ath10k_htt_rx_has_decrypt_err(msdu_head)) {
-				ath10k_warn("htt rx dropping due to decrypt-err\n");
+				ath10k_warn("htt rx dropping due to decrypt error\n");
 				ath10k_htt_rx_free_msdu_chain(msdu_head);
 				continue;
 			}
@@ -946,6 +946,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
 
 			/* Skip mgmt frames while we handle this in WMI */
 			if (status == HTT_RX_IND_MPDU_STATUS_MGMT_CTRL) {
+				ath10k_dbg(ATH10K_DBG_HTT, "htt rx mgmt ctrl\n");
 				ath10k_htt_rx_free_msdu_chain(msdu_head);
 				continue;
 			}
@@ -961,6 +962,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
 			}
 
 			if (test_bit(ATH10K_CAC_RUNNING, &htt->ar->dev_flags)) {
+				ath10k_warn("htt rx: CAC running\n");
 				ath10k_htt_rx_free_msdu_chain(msdu_head);
 				continue;
 			}
@@ -968,7 +970,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
 			/* FIXME: we do not support chaining yet.
 			 * this needs investigation */
 			if (msdu_chaining) {
-				ath10k_warn("msdu_chaining is true\n");
+				ath10k_warn("htt rx: msdu_chaining is true\n");
 				ath10k_htt_rx_free_msdu_chain(msdu_head);
 				continue;
 			}
@@ -1103,7 +1105,7 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt,
 
 	skb_trim(info.skb, info.skb->len - trim);
 
-	ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt frag mpdu: ",
+	ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt rx frag mpdu: ",
 			info.skb->data, info.skb->len);
 	ath10k_process_rx(htt->ar, &info);
 
@@ -1124,7 +1126,7 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
 	if (!IS_ALIGNED((unsigned long)skb->data, 4))
 		ath10k_warn("unaligned htt message, expect trouble\n");
 
-	ath10k_dbg(ATH10K_DBG_HTT, "HTT RX, msg_type: 0x%0X\n",
+	ath10k_dbg(ATH10K_DBG_HTT, "htt rx, msg_type: 0x%0X\n",
 		   resp->hdr.msg_type);
 	switch (resp->hdr.msg_type) {
 	case HTT_T2H_MSG_TYPE_VERSION_CONF: {
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index f1d36d2..acaa046 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -460,9 +460,9 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 					   DMA_TO_DEVICE);
 	}
 
-	ath10k_dbg(ATH10K_DBG_HTT, "msdu 0x%llx\n",
+	ath10k_dbg(ATH10K_DBG_HTT, "tx-msdu 0x%llx\n",
 		   (unsigned long long) ATH10K_SKB_CB(msdu)->paddr);
-	ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "msdu: ",
+	ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "tx-msdu: ",
 			msdu->data, msdu->len);
 
 	skb_put(txdesc, desc_len);
-- 
1.7.11.7



From greearb at candelatech.com  Wed Jan 22 19:37:04 2014
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 22 Jan 2014 16:37:04 -0800
Subject: BAR error, failed to get chip id.
In-Reply-To: <CAJ-VmokveU-WxqboRhdagLwp2E2o-Bic7Pd4LvHaj7TX+rBnYA@mail.gmail.com>
References: <52E02B28.6020503@candelatech.com>
 <CAJ-VmokveU-WxqboRhdagLwp2E2o-Bic7Pd4LvHaj7TX+rBnYA@mail.gmail.com>
Message-ID: <52E06430.5060408@candelatech.com>

On 01/22/2014 04:10 PM, Adrian Chadd wrote:
> Tgis is rev 2.0 right? I recall reset bugs in 1.0 that had the pcie bits not setup right by the firmware after a cold reset.

I'm using a rev 2 development NIC (CUS223, I think..haven't cracked the
machine open in a while).

I usually get about 1-3 module reloads before the system either totally
freezes or prints out the info below (and fails to load the driver),
requiring reboot of the system.

I have been working on other features and bugs and have been ignoring
these lockups, but now I'm a bit more interested in trying to resolve
them...

Thanks,
Ben


> 
> Adrian
> 
> On Jan 22, 2014 3:34 PM, "Ben Greear" <greearb at candelatech.com <mailto:greearb at candelatech.com>> wrote:
> 
> 
>     I see this fairly often on module reload.  Firmware is modified
>     by me, based on 10.1.389, so if there are firmware fixes since then
>     that address this problem I would not know of it.  Kernel is ath-testing,
>     with some local changes, but nothing pertaining to the pci code.
> 
> 
>     Kernel 3.13.0-rc8-wl-ath+ on an x86_64 (ttyS0)
> 
>     ct523-9292 login: ath10k_pci 0000:05:00.0: BAR 0: error updating (0xf4400004 != 0xffffffff)
>     ath10k_pci 0000:05:00.0: BAR 0: error updating (high 0x000000 != 0xffffffff)
>     ath10k: Failed to get chip id: -110
> 
> 
>     After this, it takes a power cycle to get the system working again.
> 
>     Anyone seen similar?
> 
>     Thanks,
>     Ben
> 
>     --
>     Ben Greear <greearb at candelatech.com <mailto:greearb at candelatech.com>>
>     Candela Technologies Inc  http://www.candelatech.com
> 
> 
>     _______________________________________________
>     ath10k mailing list
>     ath10k at lists.infradead.org <mailto:ath10k at lists.infradead.org>
>     http://lists.infradead.org/mailman/listinfo/ath10k
> 


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Wed Jan 22 19:41:15 2014
From: greearb at candelatech.com (greearb at candelatech.com)
Date: Wed, 22 Jan 2014 16:41:15 -0800
Subject: [PATCH 1/2] ath10k:  Support 32 stations.
Message-ID: <1390437676-19906-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

Implement 64-bit vdev map to support larger numbers
of virtual devices.  Support up to 32 stations
(actual limit will be determined when loading firmware,
as different firmwares have different limits)

Enable larger limits when using Candela Technologies
firmware.

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 drivers/net/wireless/ath/ath10k/core.c |  8 +++-
 drivers/net/wireless/ath/ath10k/core.h |  5 ++-
 drivers/net/wireless/ath/ath10k/hw.h   |  6 +++
 drivers/net/wireless/ath/ath10k/mac.c  | 68 +++++++++++++++++++++++++++-------
 drivers/net/wireless/ath/ath10k/wmi.c  | 23 +++++++++---
 5 files changed, 90 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 56048b1..3f37bf8 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -833,7 +833,13 @@ int ath10k_core_start(struct ath10k *ar)
 	if (status)
 		goto err_disconnect_htc;
 
-	ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1;
+	if (test_bit(ATH10K_FW_FEATURE_WMI_10X_CT, ar->fw_features))
+		ar->free_vdev_map = (1LL << TARGET_10X_NUM_VDEVS_CT) - 1;
+	else if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features))
+		ar->free_vdev_map = (1LL << TARGET_10X_NUM_VDEVS) - 1;
+	else
+		ar->free_vdev_map = (1LL << TARGET_NUM_VDEVS) - 1;
+
 	INIT_LIST_HEAD(&ar->arvifs);
 
 	if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags))
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ade1781..06a6b20 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -314,6 +314,9 @@ enum ath10k_fw_features {
 	/* Firmware does not support P2P */
 	ATH10K_FW_FEATURE_NO_P2P = 3,
 
+	/* Firmware from Candela Technologies, enables more VIFs, etc */
+	ATH10K_FW_FEATURE_WMI_10X_CT = 4,
+
 	/* keep last */
 	ATH10K_FW_FEATURE_COUNT,
 };
@@ -412,7 +415,7 @@ struct ath10k {
 	/* valid during scan; needed for mgmt rx during scan */
 	struct ieee80211_channel *scan_channel;
 
-	int free_vdev_map;
+	unsigned long long free_vdev_map;
 	int monitor_vdev_id;
 	bool monitor_enabled;
 	bool monitor_present;
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index f1505a2..7718c53 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -116,6 +116,12 @@ enum ath10k_mcast2ucast_mode {
 #define TARGET_10X_AST_SKID_LIMIT		16
 #define TARGET_10X_NUM_PEERS			(128 + (TARGET_10X_NUM_VDEVS))
 #define TARGET_10X_NUM_PEERS_MAX		128
+
+/* Over-rides for Candela Technologies firmware */
+#define TARGET_10X_NUM_VDEVS_CT			32
+#define TARGET_10X_NUM_PEERS_CT			(32 + (TARGET_10X_NUM_VDEVS_CT))
+#define TARGET_10X_AST_SKID_LIMIT_CT		(TARGET_10X_NUM_PEERS_CT * TARGET_10X_NUM_PEER_AST)
+
 #define TARGET_10X_NUM_OFFLOAD_PEERS		0
 #define TARGET_10X_NUM_OFFLOAD_REORDER_BUFS	0
 #define TARGET_10X_NUM_PEER_KEYS		2
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 10bd18d..7b79ddd 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -627,14 +627,14 @@ static int ath10k_monitor_create(struct ath10k *ar)
 		return 0;
 	}
 
-	bit = ffs(ar->free_vdev_map);
-	if (bit == 0) {
+	bit = __ffs64(ar->free_vdev_map);
+	if (bit == 0 || !ar->free_vdev_map) {
 		ath10k_warn("No free VDEV slots\n");
 		return -ENOMEM;
 	}
 
 	ar->monitor_vdev_id = bit - 1;
-	ar->free_vdev_map &= ~(1 << ar->monitor_vdev_id);
+	ar->free_vdev_map &= ~(1LL << ar->monitor_vdev_id);
 
 	ret = ath10k_wmi_vdev_create(ar, ar->monitor_vdev_id,
 				     WMI_VDEV_TYPE_MONITOR,
@@ -654,7 +654,7 @@ vdev_fail:
 	/*
 	 * Restore the ID to the global map.
 	 */
-	ar->free_vdev_map |= 1 << (ar->monitor_vdev_id);
+	ar->free_vdev_map |= (1LL << ar->monitor_vdev_id);
 	return ret;
 }
 
@@ -673,7 +673,7 @@ static int ath10k_monitor_destroy(struct ath10k *ar)
 		return ret;
 	}
 
-	ar->free_vdev_map |= 1 << (ar->monitor_vdev_id);
+	ar->free_vdev_map |= (1LL << ar->monitor_vdev_id);
 	ar->monitor_present = false;
 
 	ath10k_dbg(ATH10K_DBG_MAC, "mac monitor vdev %d deleted\n",
@@ -2234,13 +2234,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 		goto err;
 	}
 
-	bit = ffs(ar->free_vdev_map);
-	if (bit == 0) {
+	bit = __ffs64(ar->free_vdev_map);
+	if (!ar->free_vdev_map) {
+		ath10k_warn("Free vdev map is empty, no more interfaces allowed: %llu, bit: %i\n",
+			    ar->free_vdev_map, bit);
 		ret = -EBUSY;
 		goto err;
 	}
+	ath10k_warn("Creating vdev id: %i  map: %llu\n",
+		    bit, ar->free_vdev_map);
 
-	arvif->vdev_id = bit - 1;
+	arvif->vdev_id = bit;
 	arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE;
 
 	if (ar->p2p)
@@ -2280,7 +2284,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 		goto err;
 	}
 
-	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+	ar->free_vdev_map &= ~(1LL << arvif->vdev_id);
 	list_add(&arvif->list, &ar->arvifs);
 
 	vdev_param = ar->wmi.vdev_param->def_keyid;
@@ -2370,7 +2374,7 @@ err_peer_delete:
 
 err_vdev_delete:
 	ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
-	ar->free_vdev_map &= ~BIT(arvif->vdev_id);
+	ar->free_vdev_map &= ~(1LL << arvif->vdev_id);
 	list_del(&arvif->list);
 
 err:
@@ -2397,7 +2401,7 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
 	}
 	spin_unlock_bh(&ar->data_lock);
 
-	ar->free_vdev_map |= 1 << (arvif->vdev_id);
+	ar->free_vdev_map |= (1LL << arvif->vdev_id);
 	list_del(&arvif->list);
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
@@ -2869,7 +2873,9 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,
 		/*
 		 * New station addition.
 		 */
-		if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features))
+		if (test_bit(ATH10K_FW_FEATURE_WMI_10X_CT, ar->fw_features))
+			max_num_peers = TARGET_10X_NUM_PEERS_CT - 1;
+		else if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features))
 			max_num_peers = TARGET_10X_NUM_PEERS_MAX - 1;
 		else
 			max_num_peers = TARGET_NUM_PEERS;
@@ -3803,6 +3809,22 @@ static const struct ieee80211_iface_limit ath10k_10x_if_limits[] = {
 	},
 };
 
+static const struct ieee80211_iface_limit ath10k_10x_ct_if_limits[] = {
+	{
+	.max	= TARGET_10X_NUM_VDEVS_CT,
+	.types	= BIT(NL80211_IFTYPE_STATION)
+		| BIT(NL80211_IFTYPE_P2P_CLIENT)
+	},
+	{
+	.max	= 3,
+	.types	= BIT(NL80211_IFTYPE_P2P_GO)
+	},
+	{
+	.max	= 7,
+	.types	= BIT(NL80211_IFTYPE_AP)
+	},
+};
+
 static const struct ieee80211_iface_combination ath10k_if_comb[] = {
 	{
 		.limits = ath10k_if_limits,
@@ -3829,6 +3851,22 @@ static const struct ieee80211_iface_combination ath10k_10x_if_comb[] = {
 	},
 };
 
+static const struct ieee80211_iface_combination ath10k_10x_ct_if_comb[] = {
+	{
+		.limits = ath10k_10x_ct_if_limits,
+		.n_limits = ARRAY_SIZE(ath10k_10x_ct_if_limits),
+		.max_interfaces = TARGET_10X_NUM_VDEVS_CT,
+		.num_different_channels = 1,
+		.beacon_int_infra_match = true,
+#ifdef CONFIG_ATH10K_DFS_CERTIFIED
+		.radar_detect_widths =	BIT(NL80211_CHAN_WIDTH_20_NOHT) |
+					BIT(NL80211_CHAN_WIDTH_20) |
+					BIT(NL80211_CHAN_WIDTH_40) |
+					BIT(NL80211_CHAN_WIDTH_80),
+#endif
+	},
+};
+
 static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
 {
 	struct ieee80211_sta_vht_cap vht_cap = {0};
@@ -4052,7 +4090,11 @@ int ath10k_mac_register(struct ath10k *ar)
 	 */
 	ar->hw->queues = 4;
 
-	if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) {
+	if (test_bit(ATH10K_FW_FEATURE_WMI_10X_CT, ar->fw_features)) {
+		ar->hw->wiphy->iface_combinations = ath10k_10x_ct_if_comb;
+		ar->hw->wiphy->n_iface_combinations =
+			ARRAY_SIZE(ath10k_10x_ct_if_comb);
+	} else if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) {
 		ar->hw->wiphy->iface_combinations = ath10k_10x_if_comb;
 		ar->hw->wiphy->n_iface_combinations =
 			ARRAY_SIZE(ath10k_10x_if_comb);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 2a89ccd..3adc4a8 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1928,6 +1928,13 @@ static void ath10k_wmi_10x_service_ready_event_rx(struct ath10k *ar,
 	u32 num_units, req_id, unit_size, num_mem_reqs, num_unit_info, i;
 	int ret;
 	struct wmi_service_ready_event_10x *ev = (void *)skb->data;
+	int my_num_peers = TARGET_10X_NUM_PEERS;
+	int my_num_vdevs = TARGET_10X_NUM_VDEVS;
+
+	if (test_bit(ATH10K_FW_FEATURE_WMI_10X_CT, ar->fw_features)) {
+		my_num_peers = TARGET_10X_NUM_PEERS_CT;
+		my_num_vdevs = TARGET_10X_NUM_VDEVS_CT;
+	}
 
 	if (skb->len < sizeof(*ev)) {
 		ath10k_warn("Service ready event was %d B but expected %zu B. Wrong firmware version?\n",
@@ -1990,9 +1997,9 @@ static void ath10k_wmi_10x_service_ready_event_rx(struct ath10k *ar,
 			 * peers, 1 extra for self peer on target */
 			/* this needs to be tied, host and target
 			 * can get out of sync */
-			num_units = TARGET_10X_NUM_PEERS + 1;
+			num_units = my_num_peers + 1;
 		else if (num_unit_info & NUM_UNITS_IS_NUM_VDEVS)
-			num_units = TARGET_10X_NUM_VDEVS + 1;
+			num_units = my_num_vdevs + 1;
 
 		ath10k_dbg(ATH10K_DBG_WMI,
 			   "wmi mem_req_id %d num_units %d num_unit_info %d unit size %d actual units %d\n",
@@ -2562,11 +2569,17 @@ static int ath10k_wmi_10x_cmd_init(struct ath10k *ar)
 	u32 len, val;
 	int i;
 
-	config.num_vdevs = __cpu_to_le32(TARGET_10X_NUM_VDEVS);
-	config.num_peers = __cpu_to_le32(TARGET_10X_NUM_PEERS);
+	if (test_bit(ATH10K_FW_FEATURE_WMI_10X_CT, ar->fw_features)) {
+		config.num_vdevs = __cpu_to_le32(TARGET_10X_NUM_VDEVS_CT);
+		config.num_peers = __cpu_to_le32(TARGET_10X_NUM_PEERS_CT);
+		config.ast_skid_limit = __cpu_to_le32(TARGET_10X_AST_SKID_LIMIT_CT);
+	} else {
+		config.num_vdevs = __cpu_to_le32(TARGET_10X_NUM_VDEVS);
+		config.num_peers = __cpu_to_le32(TARGET_10X_NUM_PEERS);
+		config.ast_skid_limit = __cpu_to_le32(TARGET_10X_AST_SKID_LIMIT);
+	}
 	config.num_peer_keys = __cpu_to_le32(TARGET_10X_NUM_PEER_KEYS);
 	config.num_tids = __cpu_to_le32(TARGET_10X_NUM_TIDS);
-	config.ast_skid_limit = __cpu_to_le32(TARGET_10X_AST_SKID_LIMIT);
 	config.tx_chain_mask = __cpu_to_le32(TARGET_10X_TX_CHAIN_MASK);
 	config.rx_chain_mask = __cpu_to_le32(TARGET_10X_RX_CHAIN_MASK);
 	config.rx_timeout_pri_vo = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI);
-- 
1.7.11.7



From greearb at candelatech.com  Wed Jan 22 19:41:16 2014
From: greearb at candelatech.com (greearb at candelatech.com)
Date: Wed, 22 Jan 2014 16:41:16 -0800
Subject: [PATCH 2/2] ath10k:  Support rx-software-crypt mode.
In-Reply-To: <1390437676-19906-1-git-send-email-greearb@candelatech.com>
References: <1390437676-19906-1-git-send-email-greearb@candelatech.com>
Message-ID: <1390437676-19906-2-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

With appropriate firmware (probably only CT firmware at this time)
this allows enabling rx-software-crypt mode.  This tells the
firmware to not decrypt any packets received, but do encrypt
(as needed) any packets on transmit.  This is implemented to get
around hardware issues that preclude using two stations to
connect to the same AP while using encryption.

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 39 ++++++++++++++++++++++++++++----
 drivers/net/wireless/ath/ath10k/mac.c    | 12 ++++++++++
 drivers/net/wireless/ath/ath10k/mac.h    |  2 ++
 drivers/net/wireless/ath/ath10k/txrx.c   | 13 +++++++----
 drivers/net/wireless/ath/ath10k/wmi.c    |  9 +++++++-
 drivers/net/wireless/ath/ath10k/wmi.h    | 15 ++++++++++++
 6 files changed, 80 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 7b0b51f..96542ad 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -21,6 +21,7 @@
 #include "txrx.h"
 #include "debug.h"
 #include "trace.h"
+#include "mac.h"
 
 #include <linux/log2.h>
 
@@ -954,12 +955,42 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
 			if (status != HTT_RX_IND_MPDU_STATUS_OK &&
 			    status != HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR &&
 			    !htt->ar->monitor_enabled) {
-				ath10k_dbg(ATH10K_DBG_HTT,
-					   "htt rx ignoring frame w/ status %d\n",
-					   status);
+				if (status == HTT_RX_IND_MPDU_STATUS_ERR_DUP) {
+					/* Saw this during some attempts at
+					 * having multiple stations connected
+					 * to same AP.  The CT firmware should
+					 * fix this.
+					 */
+					ath10k_dbg(ATH10K_DBG_HTT,
+						   "htt rx: status DUP\n");
+				} else if (status == HTT_RX_IND_MPDU_STATUS_ERR_INV_PEER) {
+					/* This often happens when in nohwcrypt mode,
+					 * ignore.
+					 */
+					if (ath10k_modparam_nohwcrypt)
+						goto continue_on;
+					ath10k_dbg(ATH10K_DBG_HTT,
+						   "htt rx:  status INVALID_PEER\n");
+				} else if (status == HTT_RX_IND_MPDU_STATUS_ERR_FCS) {
+					/* This is seen when using sw-rx-crypt
+					 * (CT firmware only, other firmware
+					 * will not do sw-rx-crypt at all))
+					 * Ignore this if we are in rx-sw-crypt
+					 * mode.
+					 */
+					if (ath10k_modparam_nohwcrypt)
+						goto continue_on;
+					ath10k_dbg(ATH10K_DBG_HTT,
+						   "htt rx:  status ERR_FCS\n");
+				} else {
+					ath10k_dbg(ATH10K_DBG_HTT,
+						   "htt rx ignoring frame w/ status %d\n",
+						   status);
+				}
 				ath10k_htt_rx_free_msdu_chain(msdu_head);
 				continue;
 			}
+continue_on:
 
 			if (test_bit(ATH10K_CAC_RUNNING, &htt->ar->dev_flags)) {
 				ath10k_warn("htt rx: CAC running\n");
@@ -979,7 +1010,7 @@ static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
 			info.fcs_err = ath10k_htt_rx_has_fcs_err(msdu_head);
 			info.mic_err = ath10k_htt_rx_has_mic_err(msdu_head);
 
-			if (info.fcs_err)
+			if (info.fcs_err && !ath10k_modparam_nohwcrypt)
 				ath10k_warn("htt rx has FCS err\n");
 
 			if (info.mic_err)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 7b79ddd..89a52ca 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -19,6 +19,7 @@
 
 #include <net/mac80211.h>
 #include <linux/etherdevice.h>
+#include <linux/module.h>
 
 #include "hif.h"
 #include "core.h"
@@ -27,6 +28,13 @@
 #include "htt.h"
 #include "txrx.h"
 
+/* 0:  Full hardware crypt
+ * 1:  Tx hardware crypt, but expect rx software crypt (use native wifi tx type)
+ */
+int ath10k_modparam_nohwcrypt;
+module_param_named(nohwcrypt, ath10k_modparam_nohwcrypt, int, 0444);
+MODULE_PARM_DESC(nohwcrypt, "Disable hardware rx decrypt feature");
+
 /**********/
 /* Crypto */
 /**********/
@@ -77,6 +85,8 @@ static int ath10k_send_key(struct ath10k_vif *arvif,
 	if (cmd == DISABLE_KEY) {
 		arg.key_cipher = WMI_CIPHER_NONE;
 		arg.key_data = NULL;
+	} else if (ath10k_modparam_nohwcrypt) {
+		key->flags |= IEEE80211_KEY_FLAG_SW_RX_CRYPT;
 	}
 
 	return ath10k_wmi_vdev_install_key(arvif->ar, &arg);
@@ -2792,6 +2802,8 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
 	mutex_lock(&ar->conf_mutex);
 
+	key->flags &= ~IEEE80211_KEY_FLAG_SW_RX_CRYPT;
+
 	if (sta)
 		peer_addr = sta->addr;
 	else if (arvif->vdev_type == WMI_VDEV_TYPE_STA)
diff --git a/drivers/net/wireless/ath/ath10k/mac.h b/drivers/net/wireless/ath/ath10k/mac.h
index ba10219..66dc604 100644
--- a/drivers/net/wireless/ath/ath10k/mac.h
+++ b/drivers/net/wireless/ath/ath10k/mac.h
@@ -21,6 +21,8 @@
 #include <net/mac80211.h>
 #include "core.h"
 
+extern int ath10k_modparam_nohwcrypt;
+
 struct ath10k_generic_iter {
 	struct ath10k *ar;
 	int ret;
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index fc3a651..4c0bace 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -224,11 +224,14 @@ void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info *info)
 	memset(status, 0, sizeof(*status));
 
 	if (info->encrypt_type != HTT_RX_MPDU_ENCRYPT_NONE) {
-		status->flag |= RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED |
-				RX_FLAG_MMIC_STRIPPED;
-		hdr->frame_control = __cpu_to_le16(
-				__le16_to_cpu(hdr->frame_control) &
-				~IEEE80211_FCTL_PROTECTED);
+		if (!ath10k_modparam_nohwcrypt) {
+			status->flag |= (RX_FLAG_DECRYPTED |
+					 RX_FLAG_IV_STRIPPED |
+					 RX_FLAG_MMIC_STRIPPED);
+			hdr->frame_control = __cpu_to_le16(
+					__le16_to_cpu(hdr->frame_control) &
+					~IEEE80211_FCTL_PROTECTED);
+		}
 	}
 
 	if (info->mic_err)
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 3adc4a8..4b8f643 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2586,7 +2586,14 @@ static int ath10k_wmi_10x_cmd_init(struct ath10k *ar)
 	config.rx_timeout_pri_vi = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI);
 	config.rx_timeout_pri_be = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_LO_PRI);
 	config.rx_timeout_pri_bk = __cpu_to_le32(TARGET_10X_RX_TIMEOUT_HI_PRI);
-	config.rx_decap_mode = __cpu_to_le32(TARGET_10X_RX_DECAP_MODE);
+	if (ath10k_modparam_nohwcrypt)
+		/* This will disable rx decryption in hardware, enable raw
+		 * rx mode, and native-wifi tx mode.  Requires 'CT' firmware.
+		 */
+		config.rx_decap_mode = __cpu_to_le32(ATH10K_HW_TXRX_RAW |
+						     ATH10k_USE_SW_RX_CRYPT);
+	else
+		config.rx_decap_mode = __cpu_to_le32(TARGET_10X_RX_DECAP_MODE);
 
 	config.scan_max_pending_reqs =
 		__cpu_to_le32(TARGET_10X_SCAN_MAX_PENDING_REQS);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 4b5e7d3..0f856d0 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -1447,7 +1447,22 @@ struct wmi_resource_config_10x {
 	 *   MAC can decap to RAW (no decap), native wifi or Ethernet types
 	 *   THis setting also determines the default TX behavior, however TX
 	 *   behavior can be modified on a per VAP basis during VAP init
+	 *
+	 *  NOTE:  Stealing some of this field for flags, only usable when
+	 *         running "CT" firmware.
+	 *   first byte: rx_decap_mode
+	 *   second byte:  reserved
+	 */
+	#define ATH10K_RX_DECAP_MODE_MASK 0xff
+	/*  Use software rx crypt.  This disables rx checksumming
+	 *  and may turn off some firmware/hardware optimizations for
+	 *  normal use case.  BUT, it does allow us to run multiple
+	 *  stations connected to the same AP.  This flag causes
+	 *  rx encapsulation to be 'raw', and tx mode to be native-wifi.
+	 *  You should probably not enable this unless you need to
+	 *  connect multiple stations to same AP.
 	 */
+	#define ATH10k_USE_SW_RX_CRYPT 0x10000
 	__le32 rx_decap_mode;
 
 	/* what is the maximum scan requests than can be queued */
-- 
1.7.11.7



From greearb at candelatech.com  Wed Jan 22 19:49:45 2014
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 22 Jan 2014 16:49:45 -0800
Subject: BAR error, failed to get chip id.
In-Reply-To: <CAJ-VmomSpAyESOnBdUHUf__=HC1wp-=otH9-v2PNJbmzLQ6mxg@mail.gmail.com>
References: <52E02B28.6020503@candelatech.com>
 <CAJ-VmokveU-WxqboRhdagLwp2E2o-Bic7Pd4LvHaj7TX+rBnYA@mail.gmail.com>
 <52E06430.5060408@candelatech.com>
 <CAJ-VmomSpAyESOnBdUHUf__=HC1wp-=otH9-v2PNJbmzLQ6mxg@mail.gmail.com>
Message-ID: <52E06729.1020300@candelatech.com>

On 01/22/2014 04:41 PM, Adrian Chadd wrote:
> We need a pcie analyzer. Can you query its port to see what errors have shown up? Maybe we can toss some delay calls in the driver path when its detaching and
> attaching..

Do you have any suggestions for a pcie analyzer?  I'd certainly consider
buying one...and maybe sending it to someone who could actually use it :)

Next time I see the BAR thing I'll see if I can find any info about
PCIe errors.

Thanks,
Ben

> 
> Adrian
> 
> On Jan 22, 2014 7:37 PM, "Ben Greear" <greearb at candelatech.com <mailto:greearb at candelatech.com>> wrote:
> 
>     On 01/22/2014 04:10 PM, Adrian Chadd wrote:
>     > Tgis is rev 2.0 right? I recall reset bugs in 1.0 that had the pcie bits not setup right by the firmware after a cold reset.
> 
>     I'm using a rev 2 development NIC (CUS223, I think..haven't cracked the
>     machine open in a while).
> 
>     I usually get about 1-3 module reloads before the system either totally
>     freezes or prints out the info below (and fails to load the driver),
>     requiring reboot of the system.
> 
>     I have been working on other features and bugs and have been ignoring
>     these lockups, but now I'm a bit more interested in trying to resolve
>     them...
> 
>     Thanks,
>     Ben
> 
> 
>     >
>     > Adrian
>     >
>     > On Jan 22, 2014 3:34 PM, "Ben Greear" <greearb at candelatech.com <mailto:greearb at candelatech.com> <mailto:greearb at candelatech.com
>     <mailto:greearb at candelatech.com>>> wrote:
>     >
>     >
>     >     I see this fairly often on module reload.  Firmware is modified
>     >     by me, based on 10.1.389, so if there are firmware fixes since then
>     >     that address this problem I would not know of it.  Kernel is ath-testing,
>     >     with some local changes, but nothing pertaining to the pci code.
>     >
>     >
>     >     Kernel 3.13.0-rc8-wl-ath+ on an x86_64 (ttyS0)
>     >
>     >     ct523-9292 login: ath10k_pci 0000:05:00.0: BAR 0: error updating (0xf4400004 != 0xffffffff)
>     >     ath10k_pci 0000:05:00.0: BAR 0: error updating (high 0x000000 != 0xffffffff)
>     >     ath10k: Failed to get chip id: -110
>     >
>     >
>     >     After this, it takes a power cycle to get the system working again.
>     >
>     >     Anyone seen similar?
>     >
>     >     Thanks,
>     >     Ben
>     >
>     >     --
>     >     Ben Greear <greearb at candelatech.com <mailto:greearb at candelatech.com> <mailto:greearb at candelatech.com <mailto:greearb at candelatech.com>>>
>     >     Candela Technologies Inc  http://www.candelatech.com
>     >
>     >
>     >     _______________________________________________
>     >     ath10k mailing list
>     >     ath10k at lists.infradead.org <mailto:ath10k at lists.infradead.org> <mailto:ath10k at lists.infradead.org <mailto:ath10k at lists.infradead.org>>
>     >     http://lists.infradead.org/mailman/listinfo/ath10k
>     >
> 
> 
>     --
>     Ben Greear <greearb at candelatech.com <mailto:greearb at candelatech.com>>
>     Candela Technologies Inc  http://www.candelatech.com
> 


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Wed Jan 22 20:40:58 2014
From: greearb at candelatech.com (Ben Greear)
Date: Wed, 22 Jan 2014 17:40:58 -0800
Subject: [PATCH 2/2] ath10k:  Support rx-software-crypt mode.
In-Reply-To: <1390437676-19906-2-git-send-email-greearb@candelatech.com>
References: <1390437676-19906-1-git-send-email-greearb@candelatech.com>
 <1390437676-19906-2-git-send-email-greearb@candelatech.com>
Message-ID: <52E0732A.8030203@candelatech.com>

On 01/22/2014 04:41 PM, greearb at candelatech.com wrote:
> From: Ben Greear <greearb at candelatech.com>
>
> With appropriate firmware (probably only CT firmware at this time)
> this allows enabling rx-software-crypt mode.  This tells the
> firmware to not decrypt any packets received, but do encrypt
> (as needed) any packets on transmit.  This is implemented to get
> around hardware issues that preclude using two stations to
> connect to the same AP while using encryption.
>

I should mention:  This depends on a mac80211 patch I sent to
the linux-wireless mailing list.  It defines and uses the key flag
used below...

Thanks,
Ben

>   /**********/
>   /* Crypto */
>   /**********/
> @@ -77,6 +85,8 @@ static int ath10k_send_key(struct ath10k_vif *arvif,
>   	if (cmd == DISABLE_KEY) {
>   		arg.key_cipher = WMI_CIPHER_NONE;
>   		arg.key_data = NULL;
> +	} else if (ath10k_modparam_nohwcrypt) {
> +		key->flags |= IEEE80211_KEY_FLAG_SW_RX_CRYPT;
>   	}
>
>   	return ath10k_wmi_vdev_install_key(arvif->ar, &arg);
> @@ -2792,6 +2802,8 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
>
>   	mutex_lock(&ar->conf_mutex);
>
> +	key->flags &= ~IEEE80211_KEY_FLAG_SW_RX_CRYPT;
> +
>   	if (sta)
>   		peer_addr = sta->addr;
>   	else if (arvif->vdev_type == WMI_VDEV_TYPE_STA)


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From kvalo at qca.qualcomm.com  Thu Jan 23 01:05:22 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 23 Jan 2014 08:05:22 +0200
Subject: BAR error, failed to get chip id.
In-Reply-To: <52E06430.5060408@candelatech.com> (Ben Greear's message of "Wed, 
 22 Jan 2014 16:37:04 -0800")
References: <52E02B28.6020503@candelatech.com>
 <CAJ-VmokveU-WxqboRhdagLwp2E2o-Bic7Pd4LvHaj7TX+rBnYA@mail.gmail.com>
 <52E06430.5060408@candelatech.com>
Message-ID: <87iotb9qsd.fsf@kamboji.qca.qualcomm.com>

Ben Greear <greearb at candelatech.com> writes:

> On 01/22/2014 04:10 PM, Adrian Chadd wrote:
>> Tgis is rev 2.0 right? I recall reset bugs in 1.0 that had the pcie bits not setup right by the firmware after a cold reset.
>
> I'm using a rev 2 development NIC (CUS223, I think..haven't cracked the
> machine open in a while).
>
> I usually get about 1-3 module reloads before the system either totally
> freezes or prints out the info below (and fails to load the driver),
> requiring reboot of the system.
>
> I have been working on other features and bugs and have been ignoring
> these lockups, but now I'm a bit more interested in trying to resolve
> them...

I was told that CUS223 has a problem with cold resets. Whenever the host
issues a cold reset occasionally voltage in one of the board component's
goes too down and causes PCI errors. I think that's what you are seeing.

The workaround is to use warm resets, but we are still having some
problems with that after firmware crashes. Hopefully we can send patches
next week.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Thu Jan 23 01:30:21 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 23 Jan 2014 08:30:21 +0200
Subject: [PATCH 1/2] ath10k:  Support 32 stations.
In-Reply-To: <1390437676-19906-1-git-send-email-greearb@candelatech.com>
 (greearb@candelatech.com's message of "Wed, 22 Jan 2014 16:41:15
 -0800")
References: <1390437676-19906-1-git-send-email-greearb@candelatech.com>
Message-ID: <8761pb9pmq.fsf@kamboji.qca.qualcomm.com>

greearb at candelatech.com writes:

> From: Ben Greear <greearb at candelatech.com>
>
> Implement 64-bit vdev map to support larger numbers
> of virtual devices.  Support up to 32 stations
> (actual limit will be determined when loading firmware,
> as different firmwares have different limits)
>
> Enable larger limits when using Candela Technologies
> firmware.
>
> Signed-off-by: Ben Greear <greearb at candelatech.com>

We are currently maintaining two different firmware branches which adds
extra effort to the developers. To be honest I'm not exactly thrilled to
start supporting a third one. Can't you maintain these out-of-tree, at
least for the time being?

-- 
Kalle Valo


From michal.kazior at tieto.com  Thu Jan 23 05:38:25 2014
From: michal.kazior at tieto.com (Michal Kazior)
Date: Thu, 23 Jan 2014 11:38:25 +0100
Subject: [PATCH 1/2] ath10k: implement channel switching
In-Reply-To: <1390473506-15677-1-git-send-email-michal.kazior@tieto.com>
References: <1390473506-15677-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1390473506-15677-2-git-send-email-michal.kazior@tieto.com>

Until now channel change wasn't propagating to FW
directly because operational channel is abstracted
by VDEVs and it wasn't really necessary since
ath10k implements hwscan and hwroc.

This effectively fixes STA CSA and allows for
future AP-like CSA as well.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |  12 ++-
 drivers/net/wireless/ath/ath10k/mac.c  | 172 ++++++++++++++++++++++++++++-----
 2 files changed, 154 insertions(+), 30 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ade1781..d39103d 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -226,6 +226,11 @@ struct ath10k_vif {
 	struct ath10k *ar;
 	struct ieee80211_vif *vif;
 
+	bool is_started;
+	bool is_up;
+	u32 aid;
+	u8 bssid[ETH_ALEN];
+
 	struct work_struct wep_key_work;
 	struct ieee80211_key_conf *wep_keys[WMI_MAX_KEY_INDEX + 1];
 	u8 def_wep_key_idx;
@@ -235,7 +240,6 @@ struct ath10k_vif {
 
 	union {
 		struct {
-			u8 bssid[ETH_ALEN];
 			u32 uapsd;
 		} sta;
 		struct {
@@ -249,9 +253,6 @@ struct ath10k_vif {
 			u32 noa_len;
 			u8 *noa_data;
 		} ap;
-		struct {
-			u8 bssid[ETH_ALEN];
-		} ibss;
 	} u;
 
 	u8 fixed_rate;
@@ -412,6 +413,9 @@ struct ath10k {
 	/* valid during scan; needed for mgmt rx during scan */
 	struct ieee80211_channel *scan_channel;
 
+	/* current operating channel definition */
+	struct cfg80211_chan_def chandef;
+
 	int free_vdev_map;
 	int monitor_vdev_id;
 	bool monitor_enabled;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 776e364..323c886 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -444,8 +444,7 @@ static inline int ath10k_vdev_setup_sync(struct ath10k *ar)
 static int ath10k_vdev_start(struct ath10k_vif *arvif)
 {
 	struct ath10k *ar = arvif->ar;
-	struct ieee80211_conf *conf = &ar->hw->conf;
-	struct ieee80211_channel *channel = conf->chandef.chan;
+	struct cfg80211_chan_def *chandef = &ar->chandef;
 	struct wmi_vdev_start_request_arg arg = {};
 	int ret = 0;
 
@@ -457,16 +456,14 @@ static int ath10k_vdev_start(struct ath10k_vif *arvif)
 	arg.dtim_period = arvif->dtim_period;
 	arg.bcn_intval = arvif->beacon_interval;
 
-	arg.channel.freq = channel->center_freq;
-
-	arg.channel.band_center_freq1 = conf->chandef.center_freq1;
-
-	arg.channel.mode = chan_to_phymode(&conf->chandef);
+	arg.channel.freq = chandef->chan->center_freq;
+	arg.channel.band_center_freq1 = chandef->center_freq1;
+	arg.channel.mode = chan_to_phymode(chandef);
 
 	arg.channel.min_power = 0;
-	arg.channel.max_power = channel->max_power * 2;
-	arg.channel.max_reg_power = channel->max_reg_power * 2;
-	arg.channel.max_antenna_gain = channel->max_antenna_gain * 2;
+	arg.channel.max_power = chandef->chan->max_power * 2;
+	arg.channel.max_reg_power = chandef->chan->max_reg_power * 2;
+	arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2;
 
 	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
 		arg.ssid = arvif->u.ap.ssid;
@@ -475,7 +472,7 @@ static int ath10k_vdev_start(struct ath10k_vif *arvif)
 
 		/* For now allow DFS for AP mode */
 		arg.channel.chan_radar =
-			!!(channel->flags & IEEE80211_CHAN_RADAR);
+			!!(chandef->chan->flags & IEEE80211_CHAN_RADAR);
 	} else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) {
 		arg.ssid = arvif->vif->bss_conf.ssid;
 		arg.ssid_len = arvif->vif->bss_conf.ssid_len;
@@ -527,7 +524,8 @@ static int ath10k_vdev_stop(struct ath10k_vif *arvif)
 
 static int ath10k_monitor_start(struct ath10k *ar, int vdev_id)
 {
-	struct ieee80211_channel *channel = ar->hw->conf.chandef.chan;
+	struct cfg80211_chan_def *chandef = &ar->chandef;
+	struct ieee80211_channel *channel = chandef->chan;
 	struct wmi_vdev_start_request_arg arg = {};
 	int ret = 0;
 
@@ -540,11 +538,11 @@ static int ath10k_monitor_start(struct ath10k *ar, int vdev_id)
 
 	arg.vdev_id = vdev_id;
 	arg.channel.freq = channel->center_freq;
-	arg.channel.band_center_freq1 = ar->hw->conf.chandef.center_freq1;
+	arg.channel.band_center_freq1 = chandef->center_freq1;
 
 	/* TODO setup this dynamically, what in case we
 	   don't have any vifs? */
-	arg.channel.mode = chan_to_phymode(&ar->hw->conf.chandef);
+	arg.channel.mode = chan_to_phymode(chandef);
 	arg.channel.chan_radar =
 			!!(channel->flags & IEEE80211_CHAN_RADAR);
 
@@ -791,6 +789,10 @@ static void ath10k_control_beaconing(struct ath10k_vif *arvif,
 
 	if (!info->enable_beacon) {
 		ath10k_vdev_stop(arvif);
+
+		arvif->is_started = false;
+		arvif->is_up = false;
+
 		return;
 	}
 
@@ -800,12 +802,21 @@ static void ath10k_control_beaconing(struct ath10k_vif *arvif,
 	if (ret)
 		return;
 
-	ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, 0, info->bssid);
+	arvif->aid = 0;
+	memcpy(arvif->bssid, info->bssid, ETH_ALEN);
+
+	ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid,
+				 arvif->bssid);
 	if (ret) {
 		ath10k_warn("Failed to bring up VDEV: %d\n",
 			    arvif->vdev_id);
+		ath10k_vdev_stop(arvif);
 		return;
 	}
+
+	arvif->is_started = true;
+	arvif->is_up = true;
+
 	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d up\n", arvif->vdev_id);
 }
 
@@ -824,18 +835,18 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif,
 			ath10k_warn("Failed to delete IBSS self peer:%pM for VDEV:%d ret:%d\n",
 				    self_peer, arvif->vdev_id, ret);
 
-		if (is_zero_ether_addr(arvif->u.ibss.bssid))
+		if (is_zero_ether_addr(arvif->bssid))
 			return;
 
 		ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id,
-					 arvif->u.ibss.bssid);
+					 arvif->bssid);
 		if (ret) {
 			ath10k_warn("Failed to delete IBSS BSSID peer:%pM for VDEV:%d ret:%d\n",
-				    arvif->u.ibss.bssid, arvif->vdev_id, ret);
+				    arvif->bssid, arvif->vdev_id, ret);
 			return;
 		}
 
-		memset(arvif->u.ibss.bssid, 0, ETH_ALEN);
+		memset(arvif->bssid, 0, ETH_ALEN);
 
 		return;
 	}
@@ -1338,11 +1349,17 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw,
 		   "mac vdev %d up (associated) bssid %pM aid %d\n",
 		   arvif->vdev_id, bss_conf->bssid, bss_conf->aid);
 
-	ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, bss_conf->aid,
-				 bss_conf->bssid);
-	if (ret)
+	arvif->aid = bss_conf->aid;
+	memcpy(arvif->bssid, bss_conf->bssid, ETH_ALEN);
+
+	ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid);
+	if (ret) {
 		ath10k_warn("VDEV: %d up failed: ret %d\n",
 			    arvif->vdev_id, ret);
+		return;
+	}
+
+	arvif->is_up = true;
 }
 
 /*
@@ -1382,6 +1399,9 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw,
 	ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id);
 
 	arvif->def_wep_key_idx = 0;
+
+	arvif->is_started = false;
+	arvif->is_up = false;
 }
 
 static int ath10k_station_assoc(struct ath10k *ar, struct ath10k_vif *arvif,
@@ -2145,6 +2165,98 @@ static int ath10k_config_ps(struct ath10k *ar)
 	return ret;
 }
 
+static const char *chandef_get_width(enum nl80211_chan_width width)
+{
+	switch (width) {
+	case NL80211_CHAN_WIDTH_20_NOHT:
+		return "20 (noht)";
+	case NL80211_CHAN_WIDTH_20:
+		return "20";
+	case NL80211_CHAN_WIDTH_40:
+		return "40";
+	case NL80211_CHAN_WIDTH_80:
+		return "80";
+	case NL80211_CHAN_WIDTH_80P80:
+		return "80+80";
+	case NL80211_CHAN_WIDTH_160:
+		return "160";
+	case NL80211_CHAN_WIDTH_5:
+		return "5";
+	case NL80211_CHAN_WIDTH_10:
+		return "10";
+	}
+	return "?";
+}
+
+static void ath10k_config_chan(struct ath10k *ar)
+{
+	struct ath10k_vif *arvif;
+	bool monitor_was_enabled;
+	int ret;
+
+	lockdep_assert_held(&ar->conf_mutex);
+
+	ath10k_dbg(ATH10K_DBG_MAC,
+		   "mac config channel to %dMHz (cf1 %dMHz cf2 %dMHz width %s)\n",
+		   ar->chandef.chan->center_freq,
+		   ar->chandef.center_freq1,
+		   ar->chandef.center_freq2,
+		   chandef_get_width(ar->chandef.width));
+
+	/* First stop monitor interface. Some FW versions crash if there's a
+	 * lone monitor interface. */
+	monitor_was_enabled = ar->monitor_enabled;
+
+	if (ar->monitor_enabled)
+		ath10k_monitor_stop(ar);
+
+	list_for_each_entry(arvif, &ar->arvifs, list) {
+		if (!arvif->is_started)
+			continue;
+
+		if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
+			continue;
+
+		ret = ath10k_vdev_stop(arvif);
+		if (ret) {
+			ath10k_warn("could not stop vdev %d (%d)\n",
+				    arvif->vdev_id, ret);
+			continue;
+		}
+	}
+
+	/* all vdevs are now stopped - now attempt to restart them */
+
+	list_for_each_entry(arvif, &ar->arvifs, list) {
+		if (!arvif->is_started)
+			continue;
+
+		if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
+			continue;
+
+		ret = ath10k_vdev_start(arvif);
+		if (ret) {
+			ath10k_warn("could not start vdev %d (%d)\n",
+				    arvif->vdev_id, ret);
+			continue;
+		}
+
+		if (!arvif->is_up)
+			continue;
+
+		ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid,
+					 arvif->bssid);
+		if (ret) {
+			ath10k_warn("could not bring vdev up %d (%d)\n",
+				    arvif->vdev_id, ret);
+			continue;
+		}
+	}
+
+	if (monitor_was_enabled)
+		ath10k_monitor_start(ar, ar->monitor_vdev_id);
+}
+
 static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
 {
 	struct ath10k *ar = hw->priv;
@@ -2165,6 +2277,11 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed)
 		spin_unlock_bh(&ar->data_lock);
 
 		ath10k_config_radar_detection(ar);
+
+		if (!cfg80211_chandef_identical(&ar->chandef, &conf->chandef)) {
+			ar->chandef = conf->chandef;
+			ath10k_config_chan(ar);
+		}
 	}
 
 	if (changed & IEEE80211_CONF_CHANGE_POWER) {
@@ -2559,15 +2676,18 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
 				 * this is never erased as we it for crypto key
 				 * clearing; this is FW requirement
 				 */
-				memcpy(arvif->u.sta.bssid, info->bssid,
-				       ETH_ALEN);
+				memcpy(arvif->bssid, info->bssid, ETH_ALEN);
 
 				ath10k_dbg(ATH10K_DBG_MAC,
 					   "mac vdev %d start %pM\n",
 					   arvif->vdev_id, info->bssid);
 
-				/* FIXME: check return value */
 				ret = ath10k_vdev_start(arvif);
+				if (ret)
+					ath10k_warn("failed to start vdev: %d\n",
+						    ret);
+				else
+					arvif->is_started = true;
 			}
 
 			/*
@@ -2576,7 +2696,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
 			 * IBSS in order to remove BSSID peer.
 			 */
 			if (vif->type == NL80211_IFTYPE_ADHOC)
-				memcpy(arvif->u.ibss.bssid, info->bssid,
+				memcpy(arvif->bssid, info->bssid,
 				       ETH_ALEN);
 		}
 	}
-- 
1.8.5.3



From michal.kazior at tieto.com  Thu Jan 23 05:38:24 2014
From: michal.kazior at tieto.com (Michal Kazior)
Date: Thu, 23 Jan 2014 11:38:24 +0100
Subject: [PATCH 0/2] ath10k: add CSA support
Message-ID: <1390473506-15677-1-git-send-email-michal.kazior@tieto.com>

Hi,

This is a refactored and rewritten AP CSA patch
split into 2. As a bonus this fixes STA CSA as
well.


Michal Kazior (2):
  ath10k: implement channel switching
  ath10k: implement AP CSA

 drivers/net/wireless/ath/ath10k/core.h |  12 ++-
 drivers/net/wireless/ath/ath10k/mac.c  | 182 ++++++++++++++++++++++++++++-----
 drivers/net/wireless/ath/ath10k/wmi.c  |  11 ++
 3 files changed, 175 insertions(+), 30 deletions(-)

-- 
1.8.5.3



From michal.kazior at tieto.com  Thu Jan 23 05:38:26 2014
From: michal.kazior at tieto.com (Michal Kazior)
Date: Thu, 23 Jan 2014 11:38:26 +0100
Subject: [PATCH 2/2] ath10k: implement AP CSA
In-Reply-To: <1390473506-15677-1-git-send-email-michal.kazior@tieto.com>
References: <1390473506-15677-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1390473506-15677-3-git-send-email-michal.kazior@tieto.com>

Most channel switching logic has been implemented
already so this patch is pretty small. The patch
makes use of mac80211's vif->csa_active for AP CSA
handling.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 10 ++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c | 11 +++++++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 323c886..ebaa8ad 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3760,6 +3760,14 @@ static int ath10k_set_bitrate_mask(struct ieee80211_hw *hw,
 	return ath10k_set_fixed_rate_param(arvif, fixed_rate, fixed_nss);
 }
 
+static void ath10k_channel_switch_beacon(struct ieee80211_hw *hw,
+					 struct ieee80211_vif *vif,
+					 struct cfg80211_chan_def *chandef)
+{
+	/* there's no need to do anything here. vif->csa_active is enough */
+	return;
+}
+
 static const struct ieee80211_ops ath10k_ops = {
 	.tx				= ath10k_tx,
 	.start				= ath10k_start,
@@ -3783,6 +3791,7 @@ static const struct ieee80211_ops ath10k_ops = {
 	.restart_complete		= ath10k_restart_complete,
 	.get_survey			= ath10k_get_survey,
 	.set_bitrate_mask		= ath10k_set_bitrate_mask,
+	.channel_switch_beacon		= ath10k_channel_switch_beacon,
 #ifdef CONFIG_PM
 	.suspend			= ath10k_suspend,
 	.resume				= ath10k_resume,
@@ -4162,6 +4171,7 @@ int ath10k_mac_register(struct ath10k *ar)
 	ar->hw->max_listen_interval = ATH10K_MAX_HW_LISTEN_INTERVAL;
 
 	ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
+	ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
 	ar->hw->wiphy->max_remain_on_channel_duration = 5000;
 
 	ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 712a606..67e91a4 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1385,6 +1385,17 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb)
 			continue;
 		}
 
+		/* There are no completions for beacons so wait for next SWBA
+		 * before telling mac80211 to decrement CSA counter
+		 *
+		 * Once CSA counter is completed stop sending beacons until
+		 * actual channel switch is done */
+		if (arvif->vif->csa_active &&
+		    ieee80211_csa_is_complete(arvif->vif)) {
+			ieee80211_csa_finish(arvif->vif);
+			continue;
+		}
+
 		bcn = ieee80211_beacon_get(ar->hw, arvif->vif);
 		if (!bcn) {
 			ath10k_warn("could not get mac80211 beacon\n");
-- 
1.8.5.3



From marek.puzyniak at tieto.com  Thu Jan 23 06:48:21 2014
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Thu, 23 Jan 2014 12:48:21 +0100
Subject: [PATCH v2] ath10k: implement and use new beacon method
Message-ID: <1390477701-16843-1-git-send-email-marek.puzyniak@tieto.com>

From: Michal Kazior <michal.kazior at tieto.com>

Until now ath10k used a copy-by-value beacon
submission.

The new method passes a DMA address via WMI
command only. This command contains additional
metadata that fixes AP behaviour with regard
to powersave buffering.

This also fixes strange bug when multicast traffic
would freeze TX indefinitely.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
---

v2:
 -rebased,
 -beacon send function refactored,
 -comments moved before field in structure declaration.


 drivers/net/wireless/ath/ath10k/core.h |  7 ++++
 drivers/net/wireless/ath/ath10k/mac.c  | 11 ++++++
 drivers/net/wireless/ath/ath10k/wmi.c  | 71 +++++++++++++++++++++++-----------
 drivers/net/wireless/ath/ath10k/wmi.h  | 21 +++++++++-
 4 files changed, 86 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index ade1781..1fce243 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -61,6 +61,11 @@ struct ath10k_skb_cb {
 		u8 frag_len;
 		u8 pad_len;
 	} __packed htt;
+
+	struct {
+		bool dtim_zero;
+		bool deliver_cab;
+	} bcn;
 } __packed;
 
 static inline struct ath10k_skb_cb *ATH10K_SKB_CB(struct sk_buff *skb)
@@ -222,6 +227,8 @@ struct ath10k_vif {
 	u32 beacon_interval;
 	u32 dtim_period;
 	struct sk_buff *beacon;
+	/* protected by data_lock */
+	bool beacon_sent;
 
 	struct ath10k *ar;
 	struct ieee80211_vif *vif;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 776e364..5973e43 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -791,6 +791,17 @@ static void ath10k_control_beaconing(struct ath10k_vif *arvif,
 
 	if (!info->enable_beacon) {
 		ath10k_vdev_stop(arvif);
+
+		spin_lock_bh(&arvif->ar->data_lock);
+		if (arvif->beacon) {
+			ath10k_skb_unmap(arvif->ar->dev, arvif->beacon);
+			dev_kfree_skb_any(arvif->beacon);
+
+			arvif->beacon = NULL;
+			arvif->beacon_sent = false;
+		}
+		spin_unlock_bh(&arvif->ar->data_lock);
+
 		return;
 	}
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 712a606..2fbc7ff 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -561,7 +561,6 @@ err_pull:
 
 static void ath10k_wmi_tx_beacon_nowait(struct ath10k_vif *arvif)
 {
-	struct wmi_bcn_tx_arg arg = {0};
 	int ret;
 
 	lockdep_assert_held(&arvif->ar->data_lock);
@@ -569,18 +568,16 @@ static void ath10k_wmi_tx_beacon_nowait(struct ath10k_vif *arvif)
 	if (arvif->beacon == NULL)
 		return;
 
-	arg.vdev_id = arvif->vdev_id;
-	arg.tx_rate = 0;
-	arg.tx_power = 0;
-	arg.bcn = arvif->beacon->data;
-	arg.bcn_len = arvif->beacon->len;
+	if (arvif->beacon_sent)
+		return;
 
-	ret = ath10k_wmi_beacon_send_nowait(arvif->ar, &arg);
+	ret = ath10k_wmi_beacon_send_ref_nowait(arvif);
 	if (ret)
 		return;
 
-	dev_kfree_skb_any(arvif->beacon);
-	arvif->beacon = NULL;
+	/* We need to retain the arvif->beacon reference for DMA unmapping and
+	 * freeing the skbuff later. */
+	arvif->beacon_sent = true;
 }
 
 static void ath10k_wmi_tx_beacons_iter(void *data, u8 *mac,
@@ -1217,6 +1214,13 @@ static void ath10k_wmi_update_tim(struct ath10k *ar,
 	tim->bitmap_ctrl = !!__le32_to_cpu(bcn_info->tim_info.tim_mcast);
 	memcpy(tim->virtual_map, arvif->u.ap.tim_bitmap, pvm_len);
 
+	if (tim->dtim_count == 0) {
+		ATH10K_SKB_CB(bcn)->bcn.dtim_zero = true;
+
+		if (__le32_to_cpu(bcn_info->tim_info.tim_mcast) == 1)
+			ATH10K_SKB_CB(bcn)->bcn.deliver_cab = true;
+	}
+
 	ath10k_dbg(ATH10K_DBG_MGMT, "dtim %d/%d mcast %d pvmlen %d\n",
 		   tim->dtim_count, tim->dtim_period,
 		   tim->bitmap_ctrl, pvm_len);
@@ -1396,13 +1400,20 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb)
 		ath10k_wmi_update_noa(ar, arvif, bcn, bcn_info);
 
 		spin_lock_bh(&ar->data_lock);
+
 		if (arvif->beacon) {
-			ath10k_warn("SWBA overrun on vdev %d\n",
-				    arvif->vdev_id);
+			if (!arvif->beacon_sent)
+				ath10k_warn("SWBA overrun on vdev %d\n",
+					    arvif->vdev_id);
+
+			ath10k_skb_unmap(ar->dev, arvif->beacon);
 			dev_kfree_skb_any(arvif->beacon);
 		}
 
+		ath10k_skb_map(ar->dev, bcn);
+
 		arvif->beacon = bcn;
+		arvif->beacon_sent = false;
 
 		ath10k_wmi_tx_beacon_nowait(arvif);
 		spin_unlock_bh(&ar->data_lock);
@@ -3411,25 +3422,41 @@ int ath10k_wmi_peer_assoc(struct ath10k *ar,
 	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_assoc_cmdid);
 }
 
-int ath10k_wmi_beacon_send_nowait(struct ath10k *ar,
-				  const struct wmi_bcn_tx_arg *arg)
+/* This function assumes the beacon is already DMA mapped */
+int ath10k_wmi_beacon_send_ref_nowait(struct ath10k_vif *arvif)
 {
-	struct wmi_bcn_tx_cmd *cmd;
+	struct wmi_bcn_tx_ref_cmd *cmd;
 	struct sk_buff *skb;
+	struct sk_buff *beacon = arvif->beacon;
+	struct ath10k *ar = arvif->ar;
+	struct ieee80211_hdr *hdr;
 	int ret;
+	u16 fc;
 
-	skb = ath10k_wmi_alloc_skb(sizeof(*cmd) + arg->bcn_len);
+	skb = ath10k_wmi_alloc_skb(sizeof(*cmd));
 	if (!skb)
 		return -ENOMEM;
 
-	cmd = (struct wmi_bcn_tx_cmd *)skb->data;
-	cmd->hdr.vdev_id  = __cpu_to_le32(arg->vdev_id);
-	cmd->hdr.tx_rate  = __cpu_to_le32(arg->tx_rate);
-	cmd->hdr.tx_power = __cpu_to_le32(arg->tx_power);
-	cmd->hdr.bcn_len  = __cpu_to_le32(arg->bcn_len);
-	memcpy(cmd->bcn, arg->bcn, arg->bcn_len);
+	hdr = (struct ieee80211_hdr *)beacon->data;
+	fc = le16_to_cpu(hdr->frame_control);
+
+	cmd = (struct wmi_bcn_tx_ref_cmd *)skb->data;
+	cmd->vdev_id = __cpu_to_le32(arvif->vdev_id);
+	cmd->data_len = __cpu_to_le32(beacon->len);
+	cmd->data_ptr = __cpu_to_le32(ATH10K_SKB_CB(beacon)->paddr);
+	cmd->msdu_id = 0;
+	cmd->frame_control = __cpu_to_le32(fc);
+	cmd->flags = 0;
+
+	if (ATH10K_SKB_CB(beacon)->bcn.dtim_zero)
+		cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DTIM_ZERO);
+
+	if (ATH10K_SKB_CB(beacon)->bcn.deliver_cab)
+		cmd->flags |= __cpu_to_le32(WMI_BCN_TX_REF_FLAG_DELIVER_CAB);
+
+	ret = ath10k_wmi_cmd_send_nowait(ar, skb,
+					 ar->wmi.cmd->pdev_send_bcn_cmdid);
 
-	ret = ath10k_wmi_cmd_send_nowait(ar, skb, ar->wmi.cmd->bcn_tx_cmdid);
 	if (ret)
 		dev_kfree_skb(skb);
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 4b5e7d3..f59be03 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -3403,6 +3403,24 @@ struct wmi_bcn_tx_arg {
 	const void *bcn;
 };
 
+enum wmi_bcn_tx_ref_flags {
+	WMI_BCN_TX_REF_FLAG_DTIM_ZERO = 0x1,
+	WMI_BCN_TX_REF_FLAG_DELIVER_CAB = 0x2,
+};
+
+struct wmi_bcn_tx_ref_cmd {
+	__le32 vdev_id;
+	__le32 data_len;
+	/* physical address of the frame - dma pointer */
+	__le32 data_ptr;
+	/* id for host to track */
+	__le32 msdu_id;
+	/* frame ctrl to setup PPDU desc */
+	__le32 frame_control;
+	/* to control CABQ traffic: WMI_BCN_TX_REF_FLAG_ */
+	__le32 flags;
+} __packed;
+
 /* Beacon filter */
 #define WMI_BCN_FILTER_ALL   0 /* Filter all beacons */
 #define WMI_BCN_FILTER_NONE  1 /* Pass all beacons */
@@ -4219,8 +4237,7 @@ int ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac,
 			       enum wmi_ap_ps_peer_param param_id, u32 value);
 int ath10k_wmi_scan_chan_list(struct ath10k *ar,
 			      const struct wmi_scan_chan_list_arg *arg);
-int ath10k_wmi_beacon_send_nowait(struct ath10k *ar,
-				  const struct wmi_bcn_tx_arg *arg);
+int ath10k_wmi_beacon_send_ref_nowait(struct ath10k_vif *arvif);
 int ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar,
 			const struct wmi_pdev_set_wmm_params_arg *arg);
 int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id);
-- 
1.8.1.2



From kvalo at qca.qualcomm.com  Thu Jan 23 06:59:08 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 23 Jan 2014 13:59:08 +0200
Subject: [PATCH 0/2] ath10k: add CSA support
In-Reply-To: <1390473506-15677-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Thu, 23 Jan 2014 11:38:24 +0100")
References: <1390473506-15677-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <87ha8u6h9v.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> This is a refactored and rewritten AP CSA patch
> split into 2. As a bonus this fixes STA CSA as
> well.
>
>
> Michal Kazior (2):
>   ath10k: implement channel switching
>   ath10k: implement AP CSA

Oddly enough only the cover letter was delivered to ath10k list, no idea
what happened to the patches. But I can get the patches from
linux-wireless lists.

But do these patches depend to any mac80211 or cfg80211 patches. Or is
it safe to take these to my ath-next branch?

-- 
Kalle Valo


From michal.kazior at tieto.com  Thu Jan 23 07:10:22 2014
From: michal.kazior at tieto.com (Michal Kazior)
Date: Thu, 23 Jan 2014 13:10:22 +0100
Subject: [PATCH 0/2] ath10k: add CSA support
In-Reply-To: <87ha8u6h9v.fsf@kamboji.qca.qualcomm.com>
References: <1390473506-15677-1-git-send-email-michal.kazior@tieto.com>
 <87ha8u6h9v.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CA+BoTQkyQBnWomTbCVqySXvXfUR1Un=4dHJuCZE3ATc9m_bJow@mail.gmail.com>

On 23 January 2014 12:59, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Michal Kazior <michal.kazior at tieto.com> writes:
>
>> This is a refactored and rewritten AP CSA patch
>> split into 2. As a bonus this fixes STA CSA as
>> well.
>>
>>
>> Michal Kazior (2):
>>   ath10k: implement channel switching
>>   ath10k: implement AP CSA
>
> Oddly enough only the cover letter was delivered to ath10k list, no idea
> what happened to the patches. But I can get the patches from
> linux-wireless lists.
>
> But do these patches depend to any mac80211 or cfg80211 patches. Or is
> it safe to take these to my ath-next branch?

It's safe take them. They don't have any strange dependencies.


Micha?


From kvalo at qca.qualcomm.com  Thu Jan 23 07:38:45 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 23 Jan 2014 14:38:45 +0200
Subject: [PATCH v2] ath10k: implement and use new beacon method
In-Reply-To: <1390477701-16843-1-git-send-email-marek.puzyniak@tieto.com>
 (Marek Puzyniak's message of "Thu, 23 Jan 2014 12:48:21 +0100")
References: <1390477701-16843-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <87zjmm50ve.fsf@kamboji.qca.qualcomm.com>

Marek Puzyniak <marek.puzyniak at tieto.com> writes:

> From: Michal Kazior <michal.kazior at tieto.com>
>
> Until now ath10k used a copy-by-value beacon
> submission.
>
> The new method passes a DMA address via WMI
> command only. This command contains additional
> metadata that fixes AP behaviour with regard
> to powersave buffering.
>
> This also fixes strange bug when multicast traffic
> would freeze TX indefinitely.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
> ---
>
> v2:
>  -rebased,
>  -beacon send function refactored,
>  -comments moved before field in structure declaration.

I had a conflict when I was applying this to ath-next-test branch for
pending patches. Can you please double check that I didn't break
anything:

https://github.com/kvalo/ath/commit/311f8996ada0e9ff94d5b122b1f022b72e0cdb39

-- 
Kalle Valo


From marek.puzyniak at tieto.com  Thu Jan 23 07:54:35 2014
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Thu, 23 Jan 2014 13:54:35 +0100
Subject: [PATCH v2] ath10k: implement and use new beacon method
In-Reply-To: <87zjmm50ve.fsf@kamboji.qca.qualcomm.com>
References: <1390477701-16843-1-git-send-email-marek.puzyniak@tieto.com>
 <87zjmm50ve.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CADnKcVh7WcxwhRpep0nhm5G2P=OZE47Qof-9BH=HcQ+UA=COyg@mail.gmail.com>

On 23 January 2014 13:38, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Marek Puzyniak <marek.puzyniak at tieto.com> writes:
>
>> From: Michal Kazior <michal.kazior at tieto.com>
>>
>> Until now ath10k used a copy-by-value beacon
>> submission.
>>
>> The new method passes a DMA address via WMI
>> command only. This command contains additional
>> metadata that fixes AP behaviour with regard
>> to powersave buffering.
>>
>> This also fixes strange bug when multicast traffic
>> would freeze TX indefinitely.
>>
>> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
>> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
>> ---
>>
>> v2:
>>  -rebased,
>>  -beacon send function refactored,
>>  -comments moved before field in structure declaration.
>
> I had a conflict when I was applying this to ath-next-test branch for
> pending patches. Can you please double check that I didn't break
> anything:
>
> https://github.com/kvalo/ath/commit/311f8996ada0e9ff94d5b122b1f022b72e0cdb39
It is OK.
>
> --
> Kalle Valo
Marek


From kvalo at qca.qualcomm.com  Thu Jan 23 07:54:33 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 23 Jan 2014 14:54:33 +0200
Subject: [PATCH v2] ath10k: enable firmware STA quick kickout
In-Reply-To: <20140120090146.5500.12995.stgit@potku.adurom.net> (Kalle Valo's
 message of "Mon, 20 Jan 2014 11:01:46 +0200")
References: <20140120090146.5500.12995.stgit@potku.adurom.net>
Message-ID: <87ob325052.fsf@kamboji.qca.qualcomm.com>

Kalle Valo <kvalo at qca.qualcomm.com> writes:

> Firmware has a feature to track if the associated STA is not acking the frames.
> When that happens, the firmware sends WMI_PEER_STA_KICKOUT_EVENTID event to the
> host. Enable that to faster detect when a STA has left BSS without sending a
> deauth frame.
>
> Also set huge keepalive timeouts to avoid using the keepalive functionality in
> the firmware.
>
> Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>

Applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Thu Jan 23 07:56:26 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 23 Jan 2014 14:56:26 +0200
Subject: [PATCH v2] ath10k: AP mode, set UAPSD params correctly
In-Reply-To: <1390284413-2703-1-git-send-email-janusz.dziedzic@tieto.com>
 (Janusz Dziedzic's message of "Tue, 21 Jan 2014 07:06:53 +0100")
References: <1390284413-2703-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <87k3dq501x.fsf@kamboji.qca.qualcomm.com>

Janusz Dziedzic <janusz.dziedzic at tieto.com> writes:

> ath10k handles UAPSD completly in the firmware.
> When works in AP mode we have to configure
> UAPSD params for each station. Without this
> patch we configure UAPSD params before we
> send peer assoc command to the FW, which was
> wrong. Next FW didn't know what should be trigger
> frame, couse UAPSD didn't work correctly in AP mode.
> To configure UAPSD params correctly we have to
> send them after peer assoc command.
>
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>

Thanks, applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Thu Jan 23 07:57:23 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 23 Jan 2014 14:57:23 +0200
Subject: [PATCH] ath10k: fix the printing of 10.x FW version when FW
 crashed
In-Reply-To: <1390296081-22788-1-git-send-email-yeohchunyeow@gmail.com>
 (Chun-Yeow Yeoh's message of "Tue, 21 Jan 2014 17:21:21 +0800")
References: <1390296081-22788-1-git-send-email-yeohchunyeow@gmail.com>
Message-ID: <87fvoe500c.fsf@kamboji.qca.qualcomm.com>

Chun-Yeow Yeoh <yeohchunyeow at gmail.com> writes:

> 10.x FW has no structure member sw_version_1. Thus,
> both fw_version_release and fw_version_build are not
> available. The provided fw_version_major is also wrong.
> Fix this by using the fw_version from struct wiphy.
>
> Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow at gmail.com>

Thanks, applied.

-- 
Kalle Valo


From greearb at candelatech.com  Thu Jan 23 11:46:49 2014
From: greearb at candelatech.com (Ben Greear)
Date: Thu, 23 Jan 2014 08:46:49 -0800
Subject: Anyone know of APs using the CUS223 NICs?
Message-ID: <52E14779.3010307@candelatech.com>

If anyone knows of a source of the CUS223 (or similar?) NICs,
even if that means buying and junking APs for the NIC, please
let me know.

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From greearb at candelatech.com  Thu Jan 23 14:02:10 2014
From: greearb at candelatech.com (Ben Greear)
Date: Thu, 23 Jan 2014 11:02:10 -0800
Subject: Anyone know of APs using the CUS223 NICs?
In-Reply-To: <01a201cf185b$f60f6b90$e22e42b0$@innovelec.co.uk>
References: <01a201cf185b$f60f6b90$e22e42b0$@innovelec.co.uk>
Message-ID: <52E16732.4090908@candelatech.com>

On 01/23/2014 08:55 AM, Trevor Cullen wrote:
> Ben
> 
> Compex have them.
> 
> http://www.compex.com.sg/productinfo.asp?item=miniPCIe&acc1Panel=1&acc2Panel
> =0 

Thanks for the suggestion.

I contacted them.  It seems they are not ready too ship yet, but maybe
in a few weeks....

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From tcc at innovelec.co.uk  Thu Jan 23 11:55:45 2014
From: tcc at innovelec.co.uk (Trevor Cullen)
Date: Thu, 23 Jan 2014 16:55:45 -0000
Subject: Anyone know of APs using the CUS223 NICs?
Message-ID: <01a201cf185b$f60f6b90$e22e42b0$@innovelec.co.uk>

Ben

Compex have them.

http://www.compex.com.sg/productinfo.asp?item=miniPCIe&acc1Panel=1&acc2Panel
=0 

Trevor
?
Trevor Cullen BSc (Hons) MIoD
Managing Director
tcc at innovelec.co.uk
www.innovelec.co.uk

Innovelec Solutions Limited 
Maylands Business Centre, Redbourn Rd,
Hemel Hempstead, Herts, HP2 7ES.
Tel: +44 (0) 1442 573035
DDI: +44 (0) 1442 573039
Mobile: +44 (0) 7785 575840 
Registration No. 06879179
VAT Registration No. GB 973 2106 29


This e-mail transmission is intended solely for the person or organisation
to whom it is addressed. It may contain confidential and privileged
information.
If you are not the intended recipient, you must not copy, distribute or
disseminate the information, or take any action in reliance of it.
If you have received this message in error, do not open any attachment but
please notify the sender deleting this message from your system.

This e-mail may contain personal views which are not those of Innovelec
Solutions Limited unless specifically stated.

Internet e-mails are not necessarily secure, Innovelec Solutions Limited
does not accept responsibility for any changes made to this message after it
was sent.

Whilst all reasonable care has been taken to ensure that this e-mail and any
attachments are virus free, no responsibility is accepted by Innovelec
Solutions Limited in this regard.
We advise that in keeping with good computing practice the recipient should
ensure they are actually virus free.


-----Original Message-----
From: ath10k [mailto:ath10k-bounces at lists.infradead.org] On Behalf Of Ben
Greear
Sent: 23 January 2014 16:47
To: ath10k at lists.infradead.org
Subject: Anyone know of APs using the CUS223 NICs?

If anyone knows of a source of the CUS223 (or similar?) NICs, even if that
means buying and junking APs for the NIC, please let me know.

Thanks,
Ben

--
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


_______________________________________________
ath10k mailing list
ath10k at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k



From kvalo at qca.qualcomm.com  Fri Jan 24 03:20:34 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 24 Jan 2014 10:20:34 +0200
Subject: [PATCH 1/2] ath10k: implement channel switching
In-Reply-To: <1390473506-15677-2-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Thu, 23 Jan 2014 11:38:25 +0100")
References: <1390473506-15677-1-git-send-email-michal.kazior@tieto.com>
 <1390473506-15677-2-git-send-email-michal.kazior@tieto.com>
Message-ID: <87ob314wq5.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> Until now channel change wasn't propagating to FW
> directly because operational channel is abstracted
> by VDEVs and it wasn't really necessary since
> ath10k implements hwscan and hwroc.
>
> This effectively fixes STA CSA and allows for
> future AP-like CSA as well.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

[...]

> @@ -2559,15 +2676,18 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
>  				 * this is never erased as we it for crypto key
>  				 * clearing; this is FW requirement
>  				 */
> -				memcpy(arvif->u.sta.bssid, info->bssid,
> -				       ETH_ALEN);
> +				memcpy(arvif->bssid, info->bssid, ETH_ALEN);
>  
>  				ath10k_dbg(ATH10K_DBG_MAC,
>  					   "mac vdev %d start %pM\n",
>  					   arvif->vdev_id, info->bssid);
>  
> -				/* FIXME: check return value */
>  				ret = ath10k_vdev_start(arvif);
> +				if (ret)
> +					ath10k_warn("failed to start vdev: %d\n",
> +						    ret);
> +				else
> +					arvif->is_started = true;
>  			}

I really don't like that if-else construct and I think it's just better
to bail out if an error happens, so I changed this to:

				ret = ath10k_vdev_start(arvif);
				if (ret) {
					ath10k_warn("failed to start vdev: %d\n",
						    ret);
					return;
				}

				arvif->is_started = true;

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 24 03:24:11 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 24 Jan 2014 10:24:11 +0200
Subject: [PATCH 0/2] ath10k: add CSA support
In-Reply-To: <1390473506-15677-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Thu, 23 Jan 2014 11:38:24 +0100")
References: <1390473506-15677-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <87k3dp4wk4.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> This is a refactored and rewritten AP CSA patch
> split into 2. As a bonus this fixes STA CSA as
> well.
>
>
> Michal Kazior (2):
>   ath10k: implement channel switching
>   ath10k: implement AP CSA

Thanks, both patches applied.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Fri Jan 24 03:25:23 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 24 Jan 2014 10:25:23 +0200
Subject: [PATCH v2] ath10k: implement and use new beacon method
In-Reply-To: <1390477701-16843-1-git-send-email-marek.puzyniak@tieto.com>
 (Marek Puzyniak's message of "Thu, 23 Jan 2014 12:48:21 +0100")
References: <1390477701-16843-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <87fvod4wi4.fsf@kamboji.qca.qualcomm.com>

Marek Puzyniak <marek.puzyniak at tieto.com> writes:

> From: Michal Kazior <michal.kazior at tieto.com>
>
> Until now ath10k used a copy-by-value beacon
> submission.
>
> The new method passes a DMA address via WMI
> command only. This command contains additional
> metadata that fixes AP behaviour with regard
> to powersave buffering.
>
> This also fixes strange bug when multicast traffic
> would freeze TX indefinitely.
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>

Thanks, applied.

-- 
Kalle Valo


From yeohchunyeow at gmail.com  Fri Jan 24 05:20:50 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Fri, 24 Jan 2014 18:20:50 +0800
Subject: fw_stats available in 10.x FW
Message-ID: <CAEFj985_s1Q=S-9EVLySzXkCorQkLn6jNBcVCeDUBqWzCw+A6Q@mail.gmail.com>

Hi, all

Try to retrieve the fw_stats on 10.x FW but no information.

Is this supported by the firmware?

-----
Chun-Yeow


From greearb at candelatech.com  Fri Jan 24 11:54:23 2014
From: greearb at candelatech.com (Ben Greear)
Date: Fri, 24 Jan 2014 08:54:23 -0800
Subject: Anyone done long term testing?
Message-ID: <52E29ABF.9040403@candelatech.com>

I left an ath10k system up overnight, running 128kbps traffic on each of 32 stations,
and by morning, the machine was OOM.

Just curious if anyone had done overnight traffic runs with any luck?

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From dave.taht at gmail.com  Fri Jan 24 12:10:07 2014
From: dave.taht at gmail.com (Dave Taht)
Date: Fri, 24 Jan 2014 12:10:07 -0500
Subject: Anyone done long term testing?
In-Reply-To: <52E29ABF.9040403@candelatech.com>
References: <52E29ABF.9040403@candelatech.com>
Message-ID: <CAA93jw7-VLz3oo57QQ17MyJdp8UvxGFdn8P=_HLM12tmpHVDBw@mail.gmail.com>

On Fri, Jan 24, 2014 at 11:54 AM, Ben Greear <greearb at candelatech.com> wrote:
> I left an ath10k system up overnight, running 128kbps traffic on each of 32 stations,
> and by morning, the machine was OOM.
>
> Just curious if anyone had done overnight traffic runs with any luck?

I am planning a truly abusive period for the ath10k starting next
month. Will start
tonight. I can't quite scale to the same number of stations as you can, but can
certainly pump a few gb through what I got on a regular basis.

>
> Thanks,
> Ben
>
> --
> Ben Greear <greearb at candelatech.com>
> Candela Technologies Inc  http://www.candelatech.com
>
>
> _______________________________________________
> ath10k mailing list
> ath10k at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k



-- 
Dave T?ht

Fixing bufferbloat with cerowrt: http://www.teklibre.com/cerowrt/subscribe.html


From kvalo at qca.qualcomm.com  Fri Jan 24 14:03:23 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 24 Jan 2014 21:03:23 +0200
Subject: Anyone done long term testing?
In-Reply-To: <52E29ABF.9040403@candelatech.com> (Ben Greear's message of "Fri, 
 24 Jan 2014 08:54:23 -0800")
References: <52E29ABF.9040403@candelatech.com>
Message-ID: <87eh3x2oec.fsf@kamboji.qca.qualcomm.com>

Ben Greear <greearb at candelatech.com> writes:

> I left an ath10k system up overnight, running 128kbps traffic on each
> of 32 stations, and by morning, the machine was OOM.

Did you see SWBA overrun warnings before the OOM? I saw one report of
such issue. This patch should help with that:

748afc4 ath10k: implement and use new beacon method

> Just curious if anyone had done overnight traffic runs with any luck?

I'm running our AP135 board with ath9k+ath10k as my main AP and have
seen SWBA overruns few times, otherwise it has been pretty stable. But I
haven't yet tested with the patch above to see if the SWBA overruns are
really gone.

-- 
Kalle Valo


From greearb at candelatech.com  Fri Jan 24 14:12:23 2014
From: greearb at candelatech.com (Ben Greear)
Date: Fri, 24 Jan 2014 11:12:23 -0800
Subject: Anyone done long term testing?
In-Reply-To: <87eh3x2oec.fsf@kamboji.qca.qualcomm.com>
References: <52E29ABF.9040403@candelatech.com>
 <87eh3x2oec.fsf@kamboji.qca.qualcomm.com>
Message-ID: <52E2BB17.1010309@candelatech.com>

On 01/24/2014 11:03 AM, Kalle Valo wrote:
> Ben Greear <greearb at candelatech.com> writes:
> 
>> I left an ath10k system up overnight, running 128kbps traffic on each
>> of 32 stations, and by morning, the machine was OOM.
> 
> Did you see SWBA overrun warnings before the OOM? I saw one report of
> such issue. This patch should help with that:
> 
> 748afc4 ath10k: implement and use new beacon method
> 
>> Just curious if anyone had done overnight traffic runs with any luck?
> 
> I'm running our AP135 board with ath9k+ath10k as my main AP and have
> seen SWBA overruns few times, otherwise it has been pretty stable. But I
> haven't yet tested with the patch above to see if the SWBA overruns are
> really gone.

I didn't notice any SWBA warnings, but perhaps they were there.
I'll keep a look out for them if it happens again.

I'm also running in station mode, with lots of station vifs, so might be
hitting some issue specific to that.  I guess in station mode I shouldn't
be sending any beacons anyway, so probably not the beacon issue.

I'll update to latest to pull in that beacon patch and continue testing.

Thanks,
Ben


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From kvalo at qca.qualcomm.com  Fri Jan 24 14:18:34 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Fri, 24 Jan 2014 21:18:34 +0200
Subject: Anyone done long term testing?
In-Reply-To: <52E2BB17.1010309@candelatech.com> (Ben Greear's message of "Fri, 
 24 Jan 2014 11:12:23 -0800")
References: <52E29ABF.9040403@candelatech.com>
 <87eh3x2oec.fsf@kamboji.qca.qualcomm.com>
 <52E2BB17.1010309@candelatech.com>
Message-ID: <874n4t2np1.fsf@kamboji.qca.qualcomm.com>

Ben Greear <greearb at candelatech.com> writes:

> On 01/24/2014 11:03 AM, Kalle Valo wrote:
>> Ben Greear <greearb at candelatech.com> writes:
>> 
>>> I left an ath10k system up overnight, running 128kbps traffic on each
>>> of 32 stations, and by morning, the machine was OOM.
>> 
>> Did you see SWBA overrun warnings before the OOM? I saw one report of
>> such issue. This patch should help with that:
>> 
>> 748afc4 ath10k: implement and use new beacon method
>> 
>>> Just curious if anyone had done overnight traffic runs with any luck?
>> 
>> I'm running our AP135 board with ath9k+ath10k as my main AP and have
>> seen SWBA overruns few times, otherwise it has been pretty stable. But I
>> haven't yet tested with the patch above to see if the SWBA overruns are
>> really gone.
>
> I didn't notice any SWBA warnings, but perhaps they were there.
> I'll keep a look out for them if it happens again.
>
> I'm also running in station mode, with lots of station vifs, so might be
> hitting some issue specific to that.  I guess in station mode I shouldn't
> be sending any beacons anyway, so probably not the beacon issue.

Heh, I didn't realise that you were using station mode. Then most likely
you are seeing something else.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Mon Jan 27 09:19:07 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Mon, 27 Jan 2014 16:19:07 +0200
Subject: [PATCH 0/2] Initial 11ac support using ath10k
In-Reply-To: <2241060.ARHWKI05xP@bentobox> (Sven Eckelmann's message of "Mon, 
 20 Jan 2014 11:29:26 +0100")
References: <1513091.zjVOOQ7NvD@bentobox>
 <87mwitpsmn.fsf@kamboji.qca.qualcomm.com>
 <878uudps7f.fsf@kamboji.qca.qualcomm.com>
 <2241060.ARHWKI05xP@bentobox>
Message-ID: <874n4pld7o.fsf@kamboji.qca.qualcomm.com>

Sven Eckelmann <sven at open-mesh.com> writes:

> On Saturday 18 January 2014 01:14:28 Kalle Valo wrote:
>
>> > Just as general information to the state of ath10k, my current test showed
>> > 
>> > some problems with it:
>> >  * Samsung GT-I9300 only got horrible slow connections to an QCA9880 but
>> >  
>> >    an Intel N6205 (using iwlwifi from v3.12) or Samsung S4 worked
>> >    "fine"
>> 
>> Could you report the I9300 issue to the ath10k list with more details,
>> please? We can try to investigate it.
>
> This is a little bit problematic. I could reproduce this problem quite well on 
> a specific date and when I tried some other day it worked fine. So it is hard 
> to report anything. The only thing I could report would be the "Failed to add 
> peer" problem which seemed to happen at the same time.
>
> Maybe I find a way to reproduce it reliable but I don't know how at the 
> moment.

The bug report doesn't need to be perfect, not all bugs are easily
reproducable, but just knowing about a bug would even help. That's why
ask people to send bug reports to ath10k at lists.infradead.org.

>> >  * Adhoc mode doesn't work at all
>> 
>> That was with 10.1 firmware? AFAIK it doesn't support adhoc at all. I
>> think we need to add a firmware feature flag to disable adhoc with that
>> firmware.
>
> It used the latest and greatest, stable(?) version of the firmware when the 
> patchset was generated: ap/firmware-2.bin_10.1.467-1
>
> The statement "doesn't support adhoc at all" makes me a little bit nervous. 
> Would you say that it is better to completely ignore the "ap" directory of the 
> firmware repo [2]? Which benefits does the ap firmware has over the ath10k 
> firmware?

So we have two firmware branches right now, "main" and "10.1". 10.1 is
solely focused on AP mode, nothing else. The main branch again has more
features, like P2P, but doesn't support AP mode as well as 10.1 does.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Tue Jan 28 05:28:59 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Tue, 28 Jan 2014 12:28:59 +0200
Subject: Unable to receive beacon in IBSS mode
In-Reply-To: <CAEFj985MVPA_e2tKqsnUMqdsGsiaEE49x9sk+hGkZev8fHMX4A@mail.gmail.com>
 (Yeoh Chun-Yeow's message of "Mon, 23 Dec 2013 15:47:20 +0800")
References: <CAEFj986wMdEPuh=hRxL=6_CmWGp7eawB82+dq6M+c2EPVj9wNQ@mail.gmail.com>
 <87a9fv3jz0.fsf@kamboji.qca.qualcomm.com>
 <CAEFj984cDmJOuAov_=2vR_4h3TwZY0LMs=pWG7TFAcv_u1=HJA@mail.gmail.com>
 <87wqiz24my.fsf@kamboji.qca.qualcomm.com>
 <CAEFj985MVPA_e2tKqsnUMqdsGsiaEE49x9sk+hGkZev8fHMX4A@mail.gmail.com>
Message-ID: <8761p4iems.fsf@kamboji.qca.qualcomm.com>

Hi,

Yeoh Chun-Yeow <yeohchunyeow at gmail.com> writes:

> It seems that the problem of adhoc mode is due to the get_tsf is not
> implemented in the driver.
>
> Can you point out which WMI command that we can use to fetch the TSF timestamp.

I took a quick look at firmware and I didn't find a way to do that. But
I'm no firmware engineer so I might have just missed it.

Can you describe in more detail how adhoc is failing?

-- 
Kalle Valo


From apenwarr at gmail.com  Tue Jan 28 12:18:05 2014
From: apenwarr at gmail.com (Avery Pennarun)
Date: Tue, 28 Jan 2014 12:18:05 -0500
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
Message-ID: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>

Hi all,

When the ath10k firmware crashes on my device (let's not worry about
why the firmware crashes right now; one problem at a time), my host
CPU (ARMv7 based) can't recover.  I get some variant of this error:

[  780.116977] Unhandled fault: imprecise external abort (0x1406) at 0x2ac3706c
[  780.124336] Internal error: : 1406 [#1] SMP

I've narrowed this down to this code in ath10k/pci.c, ath10k_pci_device_reset:

        /* Put Target, including PCIe, into RESET. */
        val = ath10k_pci_reg_read32(ar, SOC_GLOBAL_RESET_ADDRESS);
        val |= 1;
        ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
        for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
                if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
                                          RTC_STATE_COLD_RESET_MASK)
                        break;
                msleep(1);
       }

Specifically, the pci_reg_read32().  I can insert as much time as I
want between the write32 and the read32; it always performs the read,
then crashes with the PC pointing a few instructions later, inside the
msleep(), with the imprecise external abort.  I think this means the
PCI read operation has encountered a PCI target abort, which suggests
that the SOC_GLOBAL_RESET_ADDRESS line has not successfully reset the
device.  From what I understand, on x86 processors PCI target aborts
are not fatal, so you might not notice this problem on those
platforms, but it's bad on ARM.

I'm using the ath10k driver from linux-next 20140117, but I had the
same problem with 3.13-rc2 so I don't think this has changed.

Are other people seeing this?  Is there something I can try to resolve it?

Thanks,

Avery


From greearb at candelatech.com  Tue Jan 28 13:20:34 2014
From: greearb at candelatech.com (Ben Greear)
Date: Tue, 28 Jan 2014 10:20:34 -0800
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
In-Reply-To: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
References: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
Message-ID: <52E7F4F2.2030001@candelatech.com>

On 01/28/2014 09:18 AM, Avery Pennarun wrote:
> Hi all,
> 
> When the ath10k firmware crashes on my device (let's not worry about
> why the firmware crashes right now; one problem at a time), my host
> CPU (ARMv7 based) can't recover.  I get some variant of this error:

I don't know about your pci bus problem, but I'm interested in knowing
about firmware crashes (if you are at liberty to share the details).

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From apenwarr at gmail.com  Tue Jan 28 13:34:59 2014
From: apenwarr at gmail.com (Avery Pennarun)
Date: Tue, 28 Jan 2014 13:34:59 -0500
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
In-Reply-To: <52E7F4F2.2030001@candelatech.com>
References: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
 <52E7F4F2.2030001@candelatech.com>
Message-ID: <CAHqTa-2JvvRA2v3y5YF8ku02zwxzpotGDQqOUU2FkxzkQgeBAg@mail.gmail.com>

On Tue, Jan 28, 2014 at 1:20 PM, Ben Greear <greearb at candelatech.com> wrote:
> On 01/28/2014 09:18 AM, Avery Pennarun wrote:
>> When the ath10k firmware crashes on my device (let's not worry about
>> why the firmware crashes right now; one problem at a time), my host
>> CPU (ARMv7 based) can't recover.  I get some variant of this error:
>
> I don't know about your pci bus problem, but I'm interested in knowing
> about firmware crashes (if you are at liberty to share the details).

Well, since you asked... :)

I'm trying to build an especially robust system here, so when I
noticed that the driver will bring the entire system crashing down
upon a firmware crash, I've actually gone out of my way to make more
firmware crashes.  So I'm using the ath10k (not ap) firmware from a
month or so ago, in AP mode.  It's pretty easy to crash the firmware
with a sequence something like this:

- start hostapd (I'm using channel 36, HT20, no encryption)
# note that hostapd already adds a mon.wlan0 monitor interface
- iw wlan0 interface add mon0 type monitor
- ip link set mon0 up
- tcpdump -ni mon0 | head

This doesn't *always* work, but it kills the firmware maybe half the
time for me.  It may or may not be worse if there are clients
connected and pushing traffic.  I've noticed that once the firmware
has crashed once and recovered, it's hard to crash it again using the
same trick without unloading and reloading the driver.  Note that in
this case, the firmware crash doesn't always kill my host SoC with a
bus error (although sometimes it does).  Even if it doesn't die
completely, the driver generally comes out confused about the
monitoring interface(s): it prints "ath10k: Only one monitor interface
allowed", which is actually totally untrue, since before the crash I
was able to create and use two at a time.  (I think this error is a
side effect of getting out of sync with the firmware when it restarts,
and thus getting confused about "pmon" vs "vmon" monitor interfaces.)

Also, if I leave the ath10k driver running and pushing traffic for,
say, 10 minutes, the probability that the firmware will crash *and*
take my SoC with it, if I try to kill hostapd or unload the driver,
approaches 100%.

These are all problems worth worrying about, of course, but
fundamentally I really want to get the resets working.  The driver
resets in about one second when it *doesn't* crash, which is pretty
gross, but at least it means we can recover when the firmware is
crappy.  The especially crappy firmware right now makes it easier to
test the recovery process in the driver, which I want to fix first if
possible.  Once I feel good that it can recover from crashes, I will
be happier to complain about the actual crashes themselves :)

Have fun,

Avery


From greearb at candelatech.com  Tue Jan 28 14:01:40 2014
From: greearb at candelatech.com (Ben Greear)
Date: Tue, 28 Jan 2014 11:01:40 -0800
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
In-Reply-To: <CAHqTa-2JvvRA2v3y5YF8ku02zwxzpotGDQqOUU2FkxzkQgeBAg@mail.gmail.com>
References: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
 <52E7F4F2.2030001@candelatech.com>
 <CAHqTa-2JvvRA2v3y5YF8ku02zwxzpotGDQqOUU2FkxzkQgeBAg@mail.gmail.com>
Message-ID: <52E7FE94.9000608@candelatech.com>

On 01/28/2014 10:34 AM, Avery Pennarun wrote:
> On Tue, Jan 28, 2014 at 1:20 PM, Ben Greear <greearb at candelatech.com> wrote:
>> On 01/28/2014 09:18 AM, Avery Pennarun wrote:
>>> When the ath10k firmware crashes on my device (let's not worry about
>>> why the firmware crashes right now; one problem at a time), my host
>>> CPU (ARMv7 based) can't recover.  I get some variant of this error:
>>
>> I don't know about your pci bus problem, but I'm interested in knowing
>> about firmware crashes (if you are at liberty to share the details).
> 
> Well, since you asked... :)
> 
> I'm trying to build an especially robust system here, so when I
> noticed that the driver will bring the entire system crashing down
> upon a firmware crash, I've actually gone out of my way to make more
> firmware crashes.  So I'm using the ath10k (not ap) firmware from a
> month or so ago, in AP mode.  It's pretty easy to crash the firmware
> with a sequence something like this:
> 
> - start hostapd (I'm using channel 36, HT20, no encryption)
> # note that hostapd already adds a mon.wlan0 monitor interface
> - iw wlan0 interface add mon0 type monitor
> - ip link set mon0 up
> - tcpdump -ni mon0 | head
> 
> This doesn't *always* work, but it kills the firmware maybe half the
> time for me.  It may or may not be worse if there are clients
> connected and pushing traffic.  I've noticed that once the firmware
> has crashed once and recovered, it's hard to crash it again using the
> same trick without unloading and reloading the driver.  Note that in
> this case, the firmware crash doesn't always kill my host SoC with a
> bus error (although sometimes it does).  Even if it doesn't die
> completely, the driver generally comes out confused about the
> monitoring interface(s): it prints "ath10k: Only one monitor interface
> allowed", which is actually totally untrue, since before the crash I
> was able to create and use two at a time.  (I think this error is a
> side effect of getting out of sync with the firmware when it restarts,
> and thus getting confused about "pmon" vs "vmon" monitor interfaces.)
> 
> Also, if I leave the ath10k driver running and pushing traffic for,
> say, 10 minutes, the probability that the firmware will crash *and*
> take my SoC with it, if I try to kill hostapd or unload the driver,
> approaches 100%.

I see similar issues (with the reset killing the PC) on x86-64
(core-i7 CPU).  Kalle mentioned a few days ago that at least some of the
NICs had issues with cold reset and that they hoped to
have a fix that uses warm reset in a week or two.

Interestingly, I also see hard PC lockup on longer runs, but
perhaps that is related to the cold-reset issue somehow.

I'm using the 10.x AP firmware, and my method of crashing firmware
is different at the moment :)

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From apenwarr at gmail.com  Tue Jan 28 14:11:35 2014
From: apenwarr at gmail.com (Avery Pennarun)
Date: Tue, 28 Jan 2014 14:11:35 -0500
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
In-Reply-To: <52E7FE94.9000608@candelatech.com>
References: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
 <52E7F4F2.2030001@candelatech.com>
 <CAHqTa-2JvvRA2v3y5YF8ku02zwxzpotGDQqOUU2FkxzkQgeBAg@mail.gmail.com>
 <52E7FE94.9000608@candelatech.com>
Message-ID: <CAHqTa-2AEYAcXFFjGJQ+4nYqWXrK_ho3XYTWhasOOGxSCkribA@mail.gmail.com>

On Tue, Jan 28, 2014 at 2:01 PM, Ben Greear <greearb at candelatech.com> wrote:
> I see similar issues (with the reset killing the PC) on x86-64
> (core-i7 CPU).  Kalle mentioned a few days ago that at least some of the
> NICs had issues with cold reset and that they hoped to
> have a fix that uses warm reset in a week or two.

I saw some messages about this on the list, including a patch that
looked promising:
http://lists.infradead.org/pipermail/ath10k/2013-December/000888.html
but it didn't help.  I'm pretty sure stuck firmware is not something
you can warm reboot to fix.

On the other hand, when my box reboots itself, it always comes back
okay and the driver loads fine.  So clearly there is *some* reset line
in the system that's working...

> Interestingly, I also see hard PC lockup on longer runs, but
> perhaps that is related to the cold-reset issue somehow.

Longer runs?  Lucky you! :)

> I'm using the 10.x AP firmware, and my method of crashing firmware
> is different at the moment :)

Yeah, I tried the AP firmware and it lasts longer.  I'm pretty sad
that there are two different firmwares with two different sets of bugs
to choose between.


From janusz.dziedzic at gmail.com  Tue Jan 28 15:10:01 2014
From: janusz.dziedzic at gmail.com (Janusz Dziedzic)
Date: Tue, 28 Jan 2014 21:10:01 +0100
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
In-Reply-To: <CAHqTa-2JvvRA2v3y5YF8ku02zwxzpotGDQqOUU2FkxzkQgeBAg@mail.gmail.com>
References: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
 <52E7F4F2.2030001@candelatech.com>
 <CAHqTa-2JvvRA2v3y5YF8ku02zwxzpotGDQqOUU2FkxzkQgeBAg@mail.gmail.com>
Message-ID: <CAFED-j=c6i+LMY8gqiWeKehka7Z85b4h8xZNV9grAxkwLY1_yg@mail.gmail.com>

2014-01-28 Avery Pennarun <apenwarr at gmail.com>:
> On Tue, Jan 28, 2014 at 1:20 PM, Ben Greear <greearb at candelatech.com> wrote:
>> On 01/28/2014 09:18 AM, Avery Pennarun wrote:
>>> When the ath10k firmware crashes on my device (let's not worry about
>>> why the firmware crashes right now; one problem at a time), my host
>>> CPU (ARMv7 based) can't recover.  I get some variant of this error:
>>
>> I don't know about your pci bus problem, but I'm interested in knowing
>> about firmware crashes (if you are at liberty to share the details).
>
> Well, since you asked... :)
>
> I'm trying to build an especially robust system here, so when I
> noticed that the driver will bring the entire system crashing down
> upon a firmware crash, I've actually gone out of my way to make more
> firmware crashes.  So I'm using the ath10k (not ap) firmware from a
> month or so ago, in AP mode.  It's pretty easy to crash the firmware
> with a sequence something like this:
>
> - start hostapd (I'm using channel 36, HT20, no encryption)
> # note that hostapd already adds a mon.wlan0 monitor interface
> - iw wlan0 interface add mon0 type monitor
> - ip link set mon0 up
> - tcpdump -ni mon0 | head
>
FW636 have problems with monitor iface:
iw wlan0 set type monitor
ifconfig wlan0 up
tcpdump -i wlan0
Will always crash firmware after "entered promiscuous mode"

Generally in case you will have/left only one monitor interface and
active tcpdump (in your case after hostapd kill), you will always get
this crash. So using monitor interface with FW636 is not good idea.

BTW monitor works fine with 10.x FW.

BR
Janusz


From apenwarr at gmail.com  Tue Jan 28 15:51:06 2014
From: apenwarr at gmail.com (Avery Pennarun)
Date: Tue, 28 Jan 2014 15:51:06 -0500
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
In-Reply-To: <CAFED-j=c6i+LMY8gqiWeKehka7Z85b4h8xZNV9grAxkwLY1_yg@mail.gmail.com>
References: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
 <52E7F4F2.2030001@candelatech.com>
 <CAHqTa-2JvvRA2v3y5YF8ku02zwxzpotGDQqOUU2FkxzkQgeBAg@mail.gmail.com>
 <CAFED-j=c6i+LMY8gqiWeKehka7Z85b4h8xZNV9grAxkwLY1_yg@mail.gmail.com>
Message-ID: <CAHqTa-3mnugb8SZU434bsNbhP1xqHrKoEVou72k95iyZLC6hyw@mail.gmail.com>

On Tue, Jan 28, 2014 at 3:10 PM, Janusz Dziedzic
<janusz.dziedzic at gmail.com> wrote:
> FW636 have problems with monitor iface:
> iw wlan0 set type monitor
> ifconfig wlan0 up
> tcpdump -i wlan0
> Will always crash firmware after "entered promiscuous mode"
>
> Generally in case you will have/left only one monitor interface and
> active tcpdump (in your case after hostapd kill), you will always get
> this crash. So using monitor interface with FW636 is not good idea.
>
> BTW monitor works fine with 10.x FW.

Well, in this case it gives a mostly-reproducible test case for the
driver's failure to recover from firmware crashes.  So it's useful in
that respect.  I was using the 10.x firmware until I wanted an easier
way to reproduce the problem :)

Avery


From apenwarr at gmail.com  Tue Jan 28 15:55:28 2014
From: apenwarr at gmail.com (Avery Pennarun)
Date: Tue, 28 Jan 2014 15:55:28 -0500
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
In-Reply-To: <CAJ-VmokorbJ2iU4rGNYdRj+A22NR9cV-5h-tDN0pD2FCurZDpA@mail.gmail.com>
References: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
 <CAJ-VmokorbJ2iU4rGNYdRj+A22NR9cV-5h-tDN0pD2FCurZDpA@mail.gmail.com>
Message-ID: <CAHqTa-1e2pBU+UGZLOUMPPiOBU8wYMeystzC9FaRzxeMyUCEjw@mail.gmail.com>

On Tue, Jan 28, 2014 at 3:28 PM, Adrian Chadd <adrian at freebsd.org> wrote:
> Can you put a sleep in before the initial write?

I've tried adding printks and various things before the write, and it
didn't seem to help.

I also noticed that iowrite32() contains a write barrier, and
ioread32() contains a read barrier, but they're structured like this:

iowrite32() { wmb(); write32(); }
ioread32() { read32(); rmb(); }

Which means that actually the write32() and read32() do not have
barriers between them.  I think that might be a problem, but adding
the barriers didn't help either.

> There are hardware bugs that are.. delicate. What you should do is find what
> kind of reporting you can pull out of the pcie endpoint the nic is connected
> to in order to see why it threw a fatal error. Then at least we can poke it
> further.

Ok.  I'm going to see if I can hunt down a PCIe bus analyzer and find
out what the deal is.

> Its also worth asking the qca hardware team about this. They'll likely want
> to know what the pcie errors are so please figure that out.

Thanks for the advice!

Are other people not seeing this?  Or are they just trying not to
crash the firmware so they don't have to care? :)

Thanks,

Avery


From greearb at candelatech.com  Tue Jan 28 16:43:43 2014
From: greearb at candelatech.com (Ben Greear)
Date: Tue, 28 Jan 2014 13:43:43 -0800
Subject: ath10k crash on firmware crash.
Message-ID: <52E8248F.8090601@candelatech.com>

I don't think I've seen this one (or at least not recently).
...

Firmware had just crashed, then OS crashed:

ATH10K_DBG_BUFFER:
ath10k: [1] next: 0x4127f4 buf: 0x4106e4 sz: 1500 len: 0 count: 0 free: 0
ath10k: ctl_resp never came in (-110)
ath10k: failed to connect to HTC: -110
ath10k: could not init core (-110)
BUG: unable to handle kernel NULL pointer dereference at           (null)
IP: [<ffffffffa0b355c1>] ath10k_ce_send+0x1d/0x15d [ath10k_pci]
PGD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: ath10k_pci ath10k_core ath5k ath9k ath9k_common ath9k_hw ath mac80211 cfg80211 nf_nat_ipv4 ]
CPU: 1 PID: 36 Comm: kworker/1:1 Tainted: G        WC   3.13.0-rc8-wl-ath+ #8
Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 4.6.5 05/02/2012
Workqueue: events ieee80211_restart_work [mac80211]
task: ffff880215b521c0 ti: ffff880215e18000 task.ti: ffff880215e18000
RIP: 0010:[<ffffffffa0b355c1>]  [<ffffffffa0b355c1>] ath10k_ce_send+0x1d/0x15d [ath10k_pci]
RSP: 0018:ffff880215e19af8  EFLAGS: 00010292
RAX: ffff880215e19b10 RBX: 0000000000000000 RCX: 0000000000000018
RDX: 00000000d9ccf800 RSI: ffff8800c965ad00 RDI: 0000000000000000
RBP: ffff880215e19b58 R08: 0000000000000002 R09: 0000000000000000
R10: ffffffff812e1a23 R11: 0000000000000292 R12: 0000000000000018
R13: 0000000000000000 R14: 0000000000000002 R15: ffff88021562d700
FS:  0000000000000000(0000) GS:ffff88021fa80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000001a0d000 CR4: 00000000000407e0
Stack:
 d9ccf8000d47df40 ffffffffa0b367a0 ffff880215e19b10 0000000000000010
 ffff880215e19b68 ffff880215e19b28 0000000000000018 ffff8800c965ad00
 0000000000000018 0000000000000000 0000000000000002 ffff88021562d700
Call Trace:
 [<ffffffffa0b3251d>] ath10k_pci_hif_send_head+0xa7/0xcb [ath10k_pci]
 [<ffffffffa0b16cbe>] ath10k_htc_send+0x23d/0x2d0 [ath10k_core]
 [<ffffffffa0b1a169>] ath10k_wmi_cmd_send_nowait+0x5d/0x85 [ath10k_core]
 [<ffffffffa0b1aaef>] ath10k_wmi_cmd_send+0x62/0x115 [ath10k_core]
 [<ffffffff814e8abd>] ? __netdev_alloc_skb+0x4b/0x9b
 [<ffffffffa0b1c438>] ath10k_wmi_vdev_set_param+0x91/0xa3 [ath10k_core]
 [<ffffffffa0b0e0d5>] ath10k_mac_set_rts+0x3e/0x40 [ath10k_core]
 [<ffffffffa0b0e1d0>] ath10k_set_frag_threshold+0x5e/0x9c [ath10k_core]
 [<ffffffffa09d60eb>] ieee80211_reconfig+0x12a/0x7b3 [mac80211]
 [<ffffffff815a8069>] ? mutex_unlock+0x9/0xb
 [<ffffffffa09b3a40>] ieee80211_restart_work+0x5e/0x68 [mac80211]
 [<ffffffff810c01d0>] process_one_work+0x1d7/0x2fc
 [<ffffffff810c0166>] ? process_one_work+0x16d/0x2fc
 [<ffffffff810c06c8>] worker_thread+0x12e/0x1fb
 [<ffffffff810c059a>] ? rescuer_thread+0x27b/0x27b
 [<ffffffff810c5aee>] kthread+0xb5/0xbd
 [<ffffffff815a9220>] ? _raw_spin_unlock_irq+0x28/0x42
 [<ffffffff810c5a39>] ? __kthread_parkme+0x5c/0x5c
 [<ffffffff815ae04c>] ret_from_fork+0x7c/0xb0
 [<ffffffff810c5a39>] ? __kthread_parkme+0x5c/0x5c
Code: df ff d0 48 83 c4 18 5b 41 5c 41 5d 5d c3 55 48 89 e5 41 57 41 56 45 89 c6 41 55 41 54 41 89 cc 53 48 89
RIP  [<ffffffffa0b355c1>] ath10k_ce_send+0x1d/0x15d [ath10k_pci]
 RSP <ffff880215e19af8>
CR2: 0000000000000000
---[ end trace 0ff0538694d604c2 ]---

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



From michal.kazior at tieto.com  Wed Jan 29 01:26:31 2014
From: michal.kazior at tieto.com (Michal Kazior)
Date: Wed, 29 Jan 2014 07:26:31 +0100
Subject: [PATCH] ath10k: properly return err from start()
In-Reply-To: <52E8248F.8090601@candelatech.com>
References: <52E8248F.8090601@candelatech.com>
Message-ID: <1390976791-9223-1-git-send-email-michal.kazior@tieto.com>

If recovery failed ath10k returned 0 (success) and
mac80211 continued to call other driver callbacks.
This caused null dereference.

This is how the failure looked like:

ath10k: ctl_resp never came in (-110)
ath10k: failed to connect to HTC: -110
ath10k: could not init core (-110)
BUG: unable to handle kernel NULL pointer dereference at           (null)
IP: [<ffffffffa0b355c1>] ath10k_ce_send+0x1d/0x15d [ath10k_pci]
PGD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: ath10k_pci ath10k_core ath5k ath9k ath9k_common ath9k_hw ath mac80211 cfg80211 nf_nat_ipv4 ]
CPU: 1 PID: 36 Comm: kworker/1:1 Tainted: G        WC   3.13.0-rc8-wl-ath+ #8
Hardware name: To be filled by O.E.M. To be filled by O.E.M./HURONRIVER, BIOS 4.6.5 05/02/2012
Workqueue: events ieee80211_restart_work [mac80211]
task: ffff880215b521c0 ti: ffff880215e18000 task.ti: ffff880215e18000
RIP: 0010:[<ffffffffa0b355c1>]  [<ffffffffa0b355c1>] ath10k_ce_send+0x1d/0x15d [ath10k_pci]
RSP: 0018:ffff880215e19af8  EFLAGS: 00010292
RAX: ffff880215e19b10 RBX: 0000000000000000 RCX: 0000000000000018
RDX: 00000000d9ccf800 RSI: ffff8800c965ad00 RDI: 0000000000000000
RBP: ffff880215e19b58 R08: 0000000000000002 R09: 0000000000000000
R10: ffffffff812e1a23 R11: 0000000000000292 R12: 0000000000000018
R13: 0000000000000000 R14: 0000000000000002 R15: ffff88021562d700
FS:  0000000000000000(0000) GS:ffff88021fa80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000001a0d000 CR4: 00000000000407e0
Stack:
 d9ccf8000d47df40 ffffffffa0b367a0 ffff880215e19b10 0000000000000010
 ffff880215e19b68 ffff880215e19b28 0000000000000018 ffff8800c965ad00
 0000000000000018 0000000000000000 0000000000000002 ffff88021562d700
Call Trace:
 [<ffffffffa0b3251d>] ath10k_pci_hif_send_head+0xa7/0xcb [ath10k_pci]
 [<ffffffffa0b16cbe>] ath10k_htc_send+0x23d/0x2d0 [ath10k_core]
 [<ffffffffa0b1a169>] ath10k_wmi_cmd_send_nowait+0x5d/0x85 [ath10k_core]
 [<ffffffffa0b1aaef>] ath10k_wmi_cmd_send+0x62/0x115 [ath10k_core]
 [<ffffffff814e8abd>] ? __netdev_alloc_skb+0x4b/0x9b
 [<ffffffffa0b1c438>] ath10k_wmi_vdev_set_param+0x91/0xa3 [ath10k_core]
 [<ffffffffa0b0e0d5>] ath10k_mac_set_rts+0x3e/0x40 [ath10k_core]
 [<ffffffffa0b0e1d0>] ath10k_set_frag_threshold+0x5e/0x9c [ath10k_core]
 [<ffffffffa09d60eb>] ieee80211_reconfig+0x12a/0x7b3 [mac80211]
 [<ffffffff815a8069>] ? mutex_unlock+0x9/0xb
 [<ffffffffa09b3a40>] ieee80211_restart_work+0x5e/0x68 [mac80211]
 [<ffffffff810c01d0>] process_one_work+0x1d7/0x2fc
 [<ffffffff810c0166>] ? process_one_work+0x16d/0x2fc
 [<ffffffff810c06c8>] worker_thread+0x12e/0x1fb
 [<ffffffff810c059a>] ? rescuer_thread+0x27b/0x27b
 [<ffffffff810c5aee>] kthread+0xb5/0xbd
 [<ffffffff815a9220>] ? _raw_spin_unlock_irq+0x28/0x42
 [<ffffffff810c5a39>] ? __kthread_parkme+0x5c/0x5c
 [<ffffffff815ae04c>] ret_from_fork+0x7c/0xb0
 [<ffffffff810c5a39>] ? __kthread_parkme+0x5c/0x5c
Code: df ff d0 48 83 c4 18 5b 41 5c 41 5d 5d c3 55 48 89 e5 41 57 41 56 45 89 c6 41 55 41 54 41 89 cc 53 48 89
RIP  [<ffffffffa0b355c1>] ath10k_ce_send+0x1d/0x15d [ath10k_pci]
 RSP <ffff880215e19af8>
CR2: 0000000000000000

Reported-By: Ben Greear <greearb at candelatech.com>
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---

Thanks for reporting, Ben!

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

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 776e364..e3223fd 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2101,10 +2101,11 @@ static int ath10k_start(struct ieee80211_hw *hw)
 			    ret);
 
 	ath10k_regd_update(ar);
+	ret = 0;
 
 exit:
 	mutex_unlock(&ar->conf_mutex);
-	return 0;
+	return ret;
 }
 
 static void ath10k_stop(struct ieee80211_hw *hw)
-- 
1.8.5.3



From marek.puzyniak at tieto.com  Wed Jan 29 07:48:16 2014
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Wed, 29 Jan 2014 13:48:16 +0100
Subject: [PATCH] ath10k: configure access category for arp
Message-ID: <1390999696-8895-1-git-send-email-marek.puzyniak@tieto.com>

ARP frames exchange does not work properly for UAPSD enabled AP.
ARP requests which arrives with access category 0 are processed
by network stack and send back with access category 0. FW changes
access category to 6. This is causing problems when UAPSD associated
STA is sleeping after has sent ARP request. Configure ARP access
category in FW to best effort (0) solves this problem. ARP frames
will be send with access category 0.

Simplify arp ac override functionality by removing redundant entry in
pdev param maping table. There should be only one entry in pdev param
map but enum has different name for different FW.

Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 17 +++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c |  4 +---
 drivers/net/wireless/ath/ath10k/wmi.h |  1 -
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 776e364..7fd33da 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2100,6 +2100,23 @@ static int ath10k_start(struct ieee80211_hw *hw)
 		ath10k_warn("could not init WMI_PDEV_PARAM_DYNAMIC_BW (%d)\n",
 			    ret);
 
+	/*
+	 * By default FW set ARP frames ac to voice (6). In that case ARP
+	 * exchange is not working properly for UAPSD enabled AP. ARP requests
+	 * which arrives with access category 0 are processed by network stack
+	 * and send back with access category 0, but FW changes access category
+	 * to 6. Set ARP frames access category to best effort (0) solves
+	 * this problem.
+	 */
+
+	ret = ath10k_wmi_pdev_set_param(ar,
+					ar->wmi.pdev_param->arp_ac_override, 0);
+	if (ret) {
+		ath10k_warn("could not init WMI_PDEV_PARAM_ARP_AC_OVERRIDE (%d)\n",
+			    ret);
+		goto exit;
+	}
+
 	ath10k_regd_update(ar);
 
 exit:
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 712a606..ebcc698 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -420,7 +420,6 @@ static struct wmi_pdev_param_map wmi_pdev_param_map = {
 	.bcnflt_stats_update_period = WMI_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD,
 	.pmf_qos = WMI_PDEV_PARAM_PMF_QOS,
 	.arp_ac_override = WMI_PDEV_PARAM_ARP_AC_OVERRIDE,
-	.arpdhcp_ac_override = WMI_PDEV_PARAM_UNSUPPORTED,
 	.dcs = WMI_PDEV_PARAM_DCS,
 	.ani_enable = WMI_PDEV_PARAM_ANI_ENABLE,
 	.ani_poll_period = WMI_PDEV_PARAM_ANI_POLL_PERIOD,
@@ -472,8 +471,7 @@ static struct wmi_pdev_param_map wmi_10x_pdev_param_map = {
 	.bcnflt_stats_update_period =
 				WMI_10X_PDEV_PARAM_BCNFLT_STATS_UPDATE_PERIOD,
 	.pmf_qos = WMI_10X_PDEV_PARAM_PMF_QOS,
-	.arp_ac_override = WMI_PDEV_PARAM_UNSUPPORTED,
-	.arpdhcp_ac_override = WMI_10X_PDEV_PARAM_ARPDHCP_AC_OVERRIDE,
+	.arp_ac_override = WMI_10X_PDEV_PARAM_ARPDHCP_AC_OVERRIDE,
 	.dcs = WMI_10X_PDEV_PARAM_DCS,
 	.ani_enable = WMI_10X_PDEV_PARAM_ANI_ENABLE,
 	.ani_poll_period = WMI_10X_PDEV_PARAM_ANI_POLL_PERIOD,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 4b5e7d3..b776bc4 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -2277,7 +2277,6 @@ struct wmi_pdev_param_map {
 	u32 bcnflt_stats_update_period;
 	u32 pmf_qos;
 	u32 arp_ac_override;
-	u32 arpdhcp_ac_override;
 	u32 dcs;
 	u32 ani_enable;
 	u32 ani_poll_period;
-- 
1.8.1.2



From kvalo at qca.qualcomm.com  Wed Jan 29 08:14:12 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 29 Jan 2014 15:14:12 +0200
Subject: [PATCH] ath10k: configure access category for arp
In-Reply-To: <1390999696-8895-1-git-send-email-marek.puzyniak@tieto.com>
 (Marek Puzyniak's message of "Wed, 29 Jan 2014 13:48:16 +0100")
References: <1390999696-8895-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <87ppnbdj6j.fsf@kamboji.qca.qualcomm.com>

Marek Puzyniak <marek.puzyniak at tieto.com> writes:

> ARP frames exchange does not work properly for UAPSD enabled AP.
> ARP requests which arrives with access category 0 are processed
> by network stack and send back with access category 0. FW changes
> access category to 6. This is causing problems when UAPSD associated
> STA is sleeping after has sent ARP request. Configure ARP access
> category in FW to best effort (0) solves this problem. ARP frames
> will be send with access category 0.
>
> Simplify arp ac override functionality by removing redundant entry in
> pdev param maping table. There should be only one entry in pdev param
> map but enum has different name for different FW.
>
> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>

I had a conflict when I applied this to ath-next-test. Please check that
I didn't break anything:

https://github.com/kvalo/ath/commit/2e006642b3aad6a5fb91f9e560a2bbcdf74aa049

> +	ret = ath10k_wmi_pdev_set_param(ar,
> +					ar->wmi.pdev_param->arp_ac_override, 0);
> +	if (ret) {
> +		ath10k_warn("could not init WMI_PDEV_PARAM_ARP_AC_OVERRIDE (%d)\n",
> +			    ret);

I also modified this warning message to follow the style used elsewhere
in the driver.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Jan 29 08:16:54 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 29 Jan 2014 15:16:54 +0200
Subject: [PATCH 2/4] ath10k:  Print out size of wmi-ready-event message.
In-Reply-To: <1390435562-15473-2-git-send-email-greearb@candelatech.com>
 (greearb@candelatech.com's message of "Wed, 22 Jan 2014 16:06:00
 -0800")
References: <1390435562-15473-1-git-send-email-greearb@candelatech.com>
 <1390435562-15473-2-git-send-email-greearb@candelatech.com>
Message-ID: <87lhxzdj21.fsf@kamboji.qca.qualcomm.com>

greearb at candelatech.com writes:

> From: Ben Greear <greearb at candelatech.com>
>
> Signed-off-by: Ben Greear <greearb at candelatech.com>

I don't like empty commit messages. Just write even a short description
why the patch is needed.

And I guess you saw the compiler warning from the build bot for this
patch?

-- 
Kalle Valo


From marek.puzyniak at tieto.com  Wed Jan 29 08:20:13 2014
From: marek.puzyniak at tieto.com (Marek Puzyniak)
Date: Wed, 29 Jan 2014 14:20:13 +0100
Subject: [PATCH] ath10k: configure access category for arp
In-Reply-To: <87ppnbdj6j.fsf@kamboji.qca.qualcomm.com>
References: <1390999696-8895-1-git-send-email-marek.puzyniak@tieto.com>
 <87ppnbdj6j.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CADnKcVg7i1r0X6_QSA-K2666QsaHDqZ=fJqFo2OM3bs-Mz6n3g@mail.gmail.com>

On 29 January 2014 14:14, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Marek Puzyniak <marek.puzyniak at tieto.com> writes:
>
>> ARP frames exchange does not work properly for UAPSD enabled AP.
>> ARP requests which arrives with access category 0 are processed
>> by network stack and send back with access category 0. FW changes
>> access category to 6. This is causing problems when UAPSD associated
>> STA is sleeping after has sent ARP request. Configure ARP access
>> category in FW to best effort (0) solves this problem. ARP frames
>> will be send with access category 0.
>>
>> Simplify arp ac override functionality by removing redundant entry in
>> pdev param maping table. There should be only one entry in pdev param
>> map but enum has different name for different FW.
>>
>> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>
>
> I had a conflict when I applied this to ath-next-test. Please check that
> I didn't break anything:
>
> https://github.com/kvalo/ath/commit/2e006642b3aad6a5fb91f9e560a2bbcdf74aa049
It looks ok.
>
>> +     ret = ath10k_wmi_pdev_set_param(ar,
>> +                                     ar->wmi.pdev_param->arp_ac_override, 0);
>> +     if (ret) {
>> +             ath10k_warn("could not init WMI_PDEV_PARAM_ARP_AC_OVERRIDE (%d)\n",
>> +                         ret);
>
> I also modified this warning message to follow the style used elsewhere
> in the driver.
>
> --
> Kalle Valo


From agordeev at redhat.com  Wed Jan 29 08:59:06 2014
From: agordeev at redhat.com (Alexander Gordeev)
Date: Wed, 29 Jan 2014 14:59:06 +0100
Subject: [PATCH v2 0/9] Phase out pci_enable_msi_block()
In-Reply-To: <CAErSpo5ztnyyceeN38XzLasLV6eJqdbqEV0viPp3Af8U=ts23w@mail.gmail.com>
References: <cover.1389904166.git.agordeev@redhat.com>
 <CAErSpo5ztnyyceeN38XzLasLV6eJqdbqEV0viPp3Af8U=ts23w@mail.gmail.com>
Message-ID: <20140129135906.GA3495@dhcp-26-207.brq.redhat.com>

On Fri, Jan 17, 2014 at 02:00:32PM -0700, Bjorn Helgaas wrote:
> > Bjorn,
> >
> > As the release is supposedly this weekend, do you prefer
> > the patches to go to your tree or to individual trees after
> > the release?
> 
> I'd be happy to merge them, except for the fact that they probably
> wouldn't have any time in -next before I ask Linus to pull them.  So
> how about if we wait until after the release, ask the area maintainers
> to take them, and if they don't take them, I'll put them in my tree
> for v3.15?

Hi Gentleman,

As the prerequisite commit 302a252 ("PCI/MSI: Add pci_enable_msi_range()
and pci_enable_msix_range()") is in mainline now, could you please take
the ACKed patches to your trees?

Thanks!

> Bjorn

-- 
Regards,
Alexander Gordeev
agordeev at redhat.com


From kvalo at qca.qualcomm.com  Wed Jan 29 11:29:17 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 29 Jan 2014 18:29:17 +0200
Subject: fw_stats available in 10.x FW
In-Reply-To: <CAEFj985_s1Q=S-9EVLySzXkCorQkLn6jNBcVCeDUBqWzCw+A6Q@mail.gmail.com>
 (Yeoh Chun-Yeow's message of "Fri, 24 Jan 2014 18:20:50 +0800")
References: <CAEFj985_s1Q=S-9EVLySzXkCorQkLn6jNBcVCeDUBqWzCw+A6Q@mail.gmail.com>
Message-ID: <8761p221lu.fsf@kamboji.qca.qualcomm.com>

Yeoh Chun-Yeow <yeohchunyeow at gmail.com> writes:

> Try to retrieve the fw_stats on 10.x FW but no information.
>
> Is this supported by the firmware?

Yes, but IIRC you need Bartosz' patches which are not applied yet:

http://lists.infradead.org/pipermail/ath10k/2013-September/000317.html

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Jan 29 11:41:48 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 29 Jan 2014 18:41:48 +0200
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
In-Reply-To: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
 (Avery Pennarun's message of "Tue, 28 Jan 2014 12:18:05 -0500")
References: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
Message-ID: <871tzq210z.fsf@kamboji.qca.qualcomm.com>

Hi,

Avery Pennarun <apenwarr at gmail.com> writes:

> When the ath10k firmware crashes on my device (let's not worry about
> why the firmware crashes right now; one problem at a time), my host
> CPU (ARMv7 based) can't recover.  I get some variant of this error:
>
> [  780.116977] Unhandled fault: imprecise external abort (0x1406) at 0x2ac3706c
> [  780.124336] Internal error: : 1406 [#1] SMP
>
> I've narrowed this down to this code in ath10k/pci.c, ath10k_pci_device_reset:
>
>         /* Put Target, including PCIe, into RESET. */
>         val = ath10k_pci_reg_read32(ar, SOC_GLOBAL_RESET_ADDRESS);
>         val |= 1;
>         ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
>         for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
>                 if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
>                                           RTC_STATE_COLD_RESET_MASK)
>                         break;
>                 msleep(1);
>        }

Are you using CUS223 board? I was told that it has a problem with the
cold reset. When you issue the cold reset, some voltage in the board
goes too low and there's a chance that it breaks PCI communication.

> Specifically, the pci_reg_read32().  I can insert as much time as I
> want between the write32 and the read32; it always performs the read,
> then crashes with the PC pointing a few instructions later, inside the
> msleep(), with the imprecise external abort.  I think this means the
> PCI read operation has encountered a PCI target abort, which suggests
> that the SOC_GLOBAL_RESET_ADDRESS line has not successfully reset the
> device.  From what I understand, on x86 processors PCI target aborts
> are not fatal, so you might not notice this problem on those
> platforms, but it's bad on ARM.

FWIW the same problem also happens on MIPS.

> I'm using the ath10k driver from linux-next 20140117, but I had the
> same problem with 3.13-rc2 so I don't think this has changed.
>
> Are other people seeing this?  Is there something I can try to resolve it?

Yes, we see it as well. And we see it also on when doing interface down,
for example when shutting down hostapd. Soon we will post patches to
workaround the interface down issue, but for firmware crashes we haven't
yet found a reliable solution. I hope there's a way to fix warm reset to
properly recover from a firmware crash.

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Wed Jan 29 11:44:02 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Wed, 29 Jan 2014 18:44:02 +0200
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
In-Reply-To: <CAHqTa-2JvvRA2v3y5YF8ku02zwxzpotGDQqOUU2FkxzkQgeBAg@mail.gmail.com>
 (Avery Pennarun's message of "Tue, 28 Jan 2014 13:34:59 -0500")
References: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
 <52E7F4F2.2030001@candelatech.com>
 <CAHqTa-2JvvRA2v3y5YF8ku02zwxzpotGDQqOUU2FkxzkQgeBAg@mail.gmail.com>
Message-ID: <87wqhizqjx.fsf@kamboji.qca.qualcomm.com>

Avery Pennarun <apenwarr at gmail.com> writes:

> On Tue, Jan 28, 2014 at 1:20 PM, Ben Greear <greearb at candelatech.com> wrote:
>> On 01/28/2014 09:18 AM, Avery Pennarun wrote:
>>> When the ath10k firmware crashes on my device (let's not worry about
>>> why the firmware crashes right now; one problem at a time), my host
>>> CPU (ARMv7 based) can't recover.  I get some variant of this error:
>>
>> I don't know about your pci bus problem, but I'm interested in knowing
>> about firmware crashes (if you are at liberty to share the details).
>
> Well, since you asked... :)
>
> I'm trying to build an especially robust system here, so when I
> noticed that the driver will bring the entire system crashing down
> upon a firmware crash, I've actually gone out of my way to make more
> firmware crashes.

Do you know that we have simulate_fw_crash debugfs file just for testing
this? Of course it's good to test various firmware crashing scenarious,
but in some cases this debugfs file helps a lot.

-- 
Kalle Valo


From adrian at freebsd.org  Wed Jan 29 13:44:29 2014
From: adrian at freebsd.org (Adrian Chadd)
Date: Wed, 29 Jan 2014 10:44:29 -0800
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
In-Reply-To: <871tzq210z.fsf@kamboji.qca.qualcomm.com>
References: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
 <871tzq210z.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CAJ-VmomkfvaTm+=Du8FqCC=b=UG2d=8ixUK2tUsFj4_dsRL4Pg@mail.gmail.com>

Hi,

Well, the problem is more likely that the PCIe bus doesn't come back
correctly, and the next IO write hits a PCI bus error.

What about seeing if you can detect the PCIe error before it's a fatal
one (hence my email earlier about trying to decode this stuff) and
then reset the PCIe port from the PCI side?


-a


On 29 January 2014 08:41, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Hi,
>
> Avery Pennarun <apenwarr at gmail.com> writes:
>
>> When the ath10k firmware crashes on my device (let's not worry about
>> why the firmware crashes right now; one problem at a time), my host
>> CPU (ARMv7 based) can't recover.  I get some variant of this error:
>>
>> [  780.116977] Unhandled fault: imprecise external abort (0x1406) at 0x2ac3706c
>> [  780.124336] Internal error: : 1406 [#1] SMP
>>
>> I've narrowed this down to this code in ath10k/pci.c, ath10k_pci_device_reset:
>>
>>         /* Put Target, including PCIe, into RESET. */
>>         val = ath10k_pci_reg_read32(ar, SOC_GLOBAL_RESET_ADDRESS);
>>         val |= 1;
>>         ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
>>         for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
>>                 if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
>>                                           RTC_STATE_COLD_RESET_MASK)
>>                         break;
>>                 msleep(1);
>>        }
>
> Are you using CUS223 board? I was told that it has a problem with the
> cold reset. When you issue the cold reset, some voltage in the board
> goes too low and there's a chance that it breaks PCI communication.
>
>> Specifically, the pci_reg_read32().  I can insert as much time as I
>> want between the write32 and the read32; it always performs the read,
>> then crashes with the PC pointing a few instructions later, inside the
>> msleep(), with the imprecise external abort.  I think this means the
>> PCI read operation has encountered a PCI target abort, which suggests
>> that the SOC_GLOBAL_RESET_ADDRESS line has not successfully reset the
>> device.  From what I understand, on x86 processors PCI target aborts
>> are not fatal, so you might not notice this problem on those
>> platforms, but it's bad on ARM.
>
> FWIW the same problem also happens on MIPS.
>
>> I'm using the ath10k driver from linux-next 20140117, but I had the
>> same problem with 3.13-rc2 so I don't think this has changed.
>>
>> Are other people seeing this?  Is there something I can try to resolve it?
>
> Yes, we see it as well. And we see it also on when doing interface down,
> for example when shutting down hostapd. Soon we will post patches to
> workaround the interface down issue, but for firmware crashes we haven't
> yet found a reliable solution. I hope there's a way to fix warm reset to
> properly recover from a firmware crash.
>
> --
> Kalle Valo
>
> _______________________________________________
> ath10k mailing list
> ath10k at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k


From bhelgaas at google.com  Wed Jan 29 16:48:01 2014
From: bhelgaas at google.com (Bjorn Helgaas)
Date: Wed, 29 Jan 2014 14:48:01 -0700
Subject: [PATCH v2 0/9] Phase out pci_enable_msi_block()
In-Reply-To: <20140118145940.GE3640@htj.dyndns.org>
References: <cover.1389904166.git.agordeev@redhat.com>
 <CAErSpo5ztnyyceeN38XzLasLV6eJqdbqEV0viPp3Af8U=ts23w@mail.gmail.com>
 <20140118071538.GA32535@dhcp-26-207.brq.redhat.com>
 <CAErSpo4nBdnn3YYaLj6QZ8iyY2pzV8Y7msd5UxJXm1T2AYnqfg@mail.gmail.com>
 <20140118145940.GE3640@htj.dyndns.org>
Message-ID: <20140129214801.GE16825@google.com>

On Sat, Jan 18, 2014 at 09:59:40AM -0500, Tejun Heo wrote:
> On Sat, Jan 18, 2014 at 07:38:55AM -0700, Bjorn Helgaas wrote:
> > On Sat, Jan 18, 2014 at 12:15 AM, Alexander Gordeev <agordeev at redhat.com> wrote:
> > > On Fri, Jan 17, 2014 at 02:00:32PM -0700, Bjorn Helgaas wrote:
> > >> > As the release is supposedly this weekend, do you prefer
> > >> > the patches to go to your tree or to individual trees after
> > >> > the release?
> > >>
> > >> I'd be happy to merge them, except for the fact that they probably
> > >> wouldn't have any time in -next before I ask Linus to pull them.  So
> > >> how about if we wait until after the release, ask the area maintainers
> > >> to take them, and if they don't take them, I'll put them in my tree
> > >> for v3.15?
> > >
> > > Patch 11 depends on patches 1-10, so I am not sure how to better handle it.
> > > Whatever works for you ;)
> > >
> > > I am only concerned with a regression fix "ahci: Fix broken fallback to
> > > single MSI mode" which would be nice to have in 3.14. But it seems pretty
> > > much too late.
> > 
> > Tejun, if you want to ack that one, I can put it in either the first
> > 3.14 pull request or a subsequent one.  Either way, since it's a
> > regression fix, we should be able to get it in 3.14.
> 
> Acked-by: Tejun Heo <tj at kernel.org>
> 
> Please feel free to route it any way you see fit.

I applied the following to my pci/msi branch, since they had acks from
maintainers (Tejun, I assumed your ack applies to both ahci patches):

    ahci: Fix broken fallback to single MSI mode
    ahci: Use pci_enable_msi_range()
    vfio: Use pci_enable_msi_range() and pci_enable_msix_range()
    wil6210: Use pci_enable_msi_range()

I didn't do anything with these:

    ipr: Get rid of superfluous call to pci_disable_msi/msix()
    ipr: Use pci_enable_msi_range() and pci_enable_msix_range()

	The conflict with "ipr: Handle early EEH" needs to get resolved
	first.  Either Alexander's patches need to go via the same tree as
	the EEH change, or the EEH change needs to be in some published
	tree so I can cherry-pick it.

    nvme: Fix invalid call to irq_set_affinity_hint()
    nvme: Use pci_enable_msi_range() and pci_enable_msix_range()

	These don't seem fully baked yet.  If/when Keith acks them, I (or
	he) can merge them.

    ath10k: Use pci_enable_msi_range()

	This has been acked, but no longer applies to mainline (I'm
	currently at 0e47c969c65e).

Bjorn


From apenwarr at gmail.com  Wed Jan 29 21:41:53 2014
From: apenwarr at gmail.com (Avery Pennarun)
Date: Wed, 29 Jan 2014 21:41:53 -0500
Subject: ath10k driver crashes whenever firmware crashes on ARM SoC
In-Reply-To: <CAJ-VmomkfvaTm+=Du8FqCC=b=UG2d=8ixUK2tUsFj4_dsRL4Pg@mail.gmail.com>
References: <CAHqTa-3o40ROJQ1=698CVMS=+nxNGT+i98nTU+sNBBG1fSHUzA@mail.gmail.com>
 <871tzq210z.fsf@kamboji.qca.qualcomm.com>
 <CAJ-VmomkfvaTm+=Du8FqCC=b=UG2d=8ixUK2tUsFj4_dsRL4Pg@mail.gmail.com>
Message-ID: <CAHqTa-3O0_5OcTKNi0KLa--63ZYO4o7qK=VsN7Bsyi0nX+rF7g@mail.gmail.com>

On Wed, Jan 29, 2014 at 1:44 PM, Adrian Chadd <adrian at freebsd.org> wrote:
> Well, the problem is more likely that the PCIe bus doesn't come back
> correctly, and the next IO write hits a PCI bus error.
>
> What about seeing if you can detect the PCIe error before it's a fatal
> one (hence my email earlier about trying to decode this stuff) and
> then reset the PCIe port from the PCI side?

Still chasing around some people to get a PCIe bus analyzer set up.

I did try a bit with resetting the PCI bus, but there's a lot of ways
that can get messy (turns out PCI bus controllers have a lot of
registers that get reset when you reset them, who knew?), and I didn't
manage to work around all of them.

My guess however is that the PCIe bus itself is probably not broken...
but the ath10k device may not be responding to it anymore when this
problem happens.

One thing I noticed is that if I reboot my device (which completely
resets the PCI bus), it comes back and works.  So *somehow* things are
getting cleaned up without actually cutting power.


From kvalo at qca.qualcomm.com  Thu Jan 30 03:10:59 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 30 Jan 2014 10:10:59 +0200
Subject: [PATCH] ath10k: properly return err from start()
In-Reply-To: <1390976791-9223-1-git-send-email-michal.kazior@tieto.com>
 (Michal Kazior's message of "Wed, 29 Jan 2014 07:26:31 +0100")
References: <52E8248F.8090601@candelatech.com>
 <1390976791-9223-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <87r47pyjn0.fsf@kamboji.qca.qualcomm.com>

Michal Kazior <michal.kazior at tieto.com> writes:

> If recovery failed ath10k returned 0 (success) and
> mac80211 continued to call other driver callbacks.
> This caused null dereference.
>
> This is how the failure looked like:
>
> ath10k: ctl_resp never came in (-110)
> ath10k: failed to connect to HTC: -110
> ath10k: could not init core (-110)
> BUG: unable to handle kernel NULL pointer dereference at           (null)

[...]

> Reported-By: Ben Greear <greearb at candelatech.com>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

Thanks, applied.

> Thanks for reporting, Ben!

Indeed, thanks Ben. Please keep the reports coming :)

-- 
Kalle Valo


From kvalo at qca.qualcomm.com  Thu Jan 30 03:14:06 2014
From: kvalo at qca.qualcomm.com (Kalle Valo)
Date: Thu, 30 Jan 2014 10:14:06 +0200
Subject: [PATCH] ath10k: configure access category for arp
In-Reply-To: <1390999696-8895-1-git-send-email-marek.puzyniak@tieto.com>
 (Marek Puzyniak's message of "Wed, 29 Jan 2014 13:48:16 +0100")
References: <1390999696-8895-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <87mwidyjht.fsf@kamboji.qca.qualcomm.com>

Marek Puzyniak <marek.puzyniak at tieto.com> writes:

> ARP frames exchange does not work properly for UAPSD enabled AP.
> ARP requests which arrives with access category 0 are processed
> by network stack and send back with access category 0. FW changes
> access category to 6. This is causing problems when UAPSD associated
> STA is sleeping after has sent ARP request. Configure ARP access
> category in FW to best effort (0) solves this problem. ARP frames
> will be send with access category 0.
>
> Simplify arp ac override functionality by removing redundant entry in
> pdev param maping table. There should be only one entry in pdev param
> map but enum has different name for different FW.
>
> Signed-off-by: Marek Puzyniak <marek.puzyniak at tieto.com>

Thanks, applied.

-- 
Kalle Valo


From agordeev at redhat.com  Thu Jan 30 08:48:20 2014
From: agordeev at redhat.com (Alexander Gordeev)
Date: Thu, 30 Jan 2014 14:48:20 +0100
Subject: [PATCH 1/3] ath10k: Get rid of superfluous call to pci_disable_msi()
In-Reply-To: <ad5cc6d6bdf4c8f5ce4681ec27674d07fbda089e.1389904167.git.agordeev@redhat.com>
References: <cover.1389904166.git.agordeev@redhat.com>
 <ad5cc6d6bdf4c8f5ce4681ec27674d07fbda089e.1389904167.git.agordeev@redhat.com>
Message-ID: <20140130134819.GA31909@dhcp-26-207.brq.redhat.com>

Signed-off-by: Alexander Gordeev <agordeev at redhat.com>
---
 drivers/net/wireless/ath/ath10k/pci.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 29fd197..6525e1f 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2414,8 +2414,6 @@ static int ath10k_pci_init_irq(struct ath10k *ar)
 		ret = pci_enable_msi_block(ar_pci->pdev, ar_pci->num_msi_intrs);
 		if (ret == 0)
 			return 0;
-		if (ret > 0)
-			pci_disable_msi(ar_pci->pdev);
 
 		/* fall-through */
 	}
-- 
1.7.7.6

-- 
Regards,
Alexander Gordeev
agordeev at redhat.com


From agordeev at redhat.com  Thu Jan 30 08:48:54 2014
From: agordeev at redhat.com (Alexander Gordeev)
Date: Thu, 30 Jan 2014 14:48:54 +0100
Subject: [PATCH 2/3] ath10k: Disable MSI in case IRQ configuration is unknown
In-Reply-To: <ad5cc6d6bdf4c8f5ce4681ec27674d07fbda089e.1389904167.git.agordeev@redhat.com>
References: <cover.1389904166.git.agordeev@redhat.com>
 <ad5cc6d6bdf4c8f5ce4681ec27674d07fbda089e.1389904167.git.agordeev@redhat.com>
Message-ID: <20140130134853.GB31909@dhcp-26-207.brq.redhat.com>

In case IRQ configuration is unknown possibly enabled MSIs
are left enabled in ath10k_pci_deinit_irq(). This update
fixes the described misbehaviour.

Signed-off-by: Alexander Gordeev <agordeev at redhat.com>
---
 drivers/net/wireless/ath/ath10k/pci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 6525e1f..563ce77 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2480,6 +2480,8 @@ static int ath10k_pci_deinit_irq(struct ath10k *ar)
 	case MSI_NUM_REQUEST:
 		pci_disable_msi(ar_pci->pdev);
 		return 0;
+	default:
+		pci_disable_msi(ar_pci->pdev);
 	}
 
 	ath10k_warn("unknown irq configuration upon deinit\n");
-- 
1.7.7.6

-- 
Regards,
Alexander Gordeev
agordeev at redhat.com


From agordeev at redhat.com  Thu Jan 30 08:49:09 2014
From: agordeev at redhat.com (Alexander Gordeev)
Date: Thu, 30 Jan 2014 14:49:09 +0100
Subject: [PATCH v3 3/3] ath10k: Use pci_enable_msi_range()
In-Reply-To: <ad5cc6d6bdf4c8f5ce4681ec27674d07fbda089e.1389904167.git.agordeev@redhat.com>
References: <cover.1389904166.git.agordeev@redhat.com>
 <ad5cc6d6bdf4c8f5ce4681ec27674d07fbda089e.1389904167.git.agordeev@redhat.com>
Message-ID: <20140130134908.GC31909@dhcp-26-207.brq.redhat.com>

As result deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range() and pci_enable_msix_range()
interfaces.

Signed-off-by: Alexander Gordeev <agordeev at redhat.com>
---
 drivers/net/wireless/ath/ath10k/pci.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 563ce77..ad2a6cf 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2411,8 +2411,9 @@ static int ath10k_pci_init_irq(struct ath10k *ar)
 	/* Try MSI-X */
 	if (ath10k_pci_irq_mode == ATH10K_PCI_IRQ_AUTO && msix_supported) {
 		ar_pci->num_msi_intrs = MSI_NUM_REQUEST;
-		ret = pci_enable_msi_block(ar_pci->pdev, ar_pci->num_msi_intrs);
-		if (ret == 0)
+		ret = pci_enable_msi_range(ar_pci->pdev, ar_pci->num_msi_intrs,
+							 ar_pci->num_msi_intrs);
+		if (ret > 0)
 			return 0;
 
 		/* fall-through */
-- 
1.7.7.6

-- 
Regards,
Alexander Gordeev
agordeev at redhat.com


From yeohchunyeow at gmail.com  Thu Jan 30 09:18:14 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Thu, 30 Jan 2014 22:18:14 +0800
Subject: Unable to receive beacon in IBSS mode
In-Reply-To: <CAEFj986-Ovb5pd7kHO2U=LxA_P73rohvgq6vW5x=+GUamH77hA@mail.gmail.com>
References: <CAEFj986wMdEPuh=hRxL=6_CmWGp7eawB82+dq6M+c2EPVj9wNQ@mail.gmail.com>
 <87a9fv3jz0.fsf@kamboji.qca.qualcomm.com>
 <CAEFj984cDmJOuAov_=2vR_4h3TwZY0LMs=pWG7TFAcv_u1=HJA@mail.gmail.com>
 <87wqiz24my.fsf@kamboji.qca.qualcomm.com>
 <CAEFj985MVPA_e2tKqsnUMqdsGsiaEE49x9sk+hGkZev8fHMX4A@mail.gmail.com>
 <8761p4iems.fsf@kamboji.qca.qualcomm.com>
 <CAEFj986-Ovb5pd7kHO2U=LxA_P73rohvgq6vW5x=+GUamH77hA@mail.gmail.com>
Message-ID: <CAEFj986F=Xs3+uH4Gw_mkqB-gobvCRn-9P3z4hmhyh+rtHLURQ@mail.gmail.com>

When bringing up the adhoc interface, all of them will do the
beaconing. mac80211 triggers the call to the driver for getting the
latest TSF and tryto merge or join the IBSS with same SSID.

Here in net/mac80211/ibss.c

                 /*
                  * second best option: get current TSF
                  * (will return -1 if not supported)
                  */
                 rx_timestamp = drv_get_tsf(local, sdata);

In example, ath9k_htc has ath9k_htc_get_tsf, but not ath10k. So I am
wondering whether we have get tsf support in firmware.

---
Chun-Yeow

> On Jan 28, 2014 6:29 PM, "Kalle Valo" <kvalo at qca.qualcomm.com> wrote:
>>
>> Hi,
>>
>> Yeoh Chun-Yeow <yeohchunyeow at gmail.com> writes:
>>
>> > It seems that the problem of adhoc mode is due to the get_tsf is not
>> > implemented in the driver.
>> >
>> > Can you point out which WMI command that we can use to fetch the TSF
>> > timestamp.
>>
>> I took a quick look at firmware and I didn't find a way to do that. But
>> I'm no firmware engineer so I might have just missed it.
>>
>> Can you describe in more detail how adhoc is failing?
>>
>> --
>> Kalle Valo


From yeohchunyeow at gmail.com  Thu Jan 30 10:41:46 2014
From: yeohchunyeow at gmail.com (Yeoh Chun-Yeow)
Date: Thu, 30 Jan 2014 23:41:46 +0800
Subject: fw_stats available in 10.x FW
In-Reply-To: <8761p221lu.fsf@kamboji.qca.qualcomm.com>
References: <CAEFj985_s1Q=S-9EVLySzXkCorQkLn6jNBcVCeDUBqWzCw+A6Q@mail.gmail.com>
 <8761p221lu.fsf@kamboji.qca.qualcomm.com>
Message-ID: <CAEFj985utGukLe2J+WXRTz+DDu7o3urUENCMJE--BXv8HjvhFg@mail.gmail.com>

Try to apply the patches mentioned here for 10.x FW, but did not work as well.
http://lists.infradead.org/pipermail/ath10k/2013-September/000317.html

The debug always complaints "ath10k: device successfully recovered" in
AP mode.... STA is not able to associate with the AP.

The FW tested is version 1.0.0.716, is this going to be available?

----
Chun-Yeow

On Thu, Jan 30, 2014 at 12:29 AM, Kalle Valo <kvalo at qca.qualcomm.com> wrote:
> Yeoh Chun-Yeow <yeohchunyeow at gmail.com> writes:
>
>> Try to retrieve the fw_stats on 10.x FW but no information.
>>
>> Is this supported by the firmware?
>
> Yes, but IIRC you need Bartosz' patches which are not applied yet:
>
> http://lists.infradead.org/pipermail/ath10k/2013-September/000317.html
>
> --
> Kalle Valo


