All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-01-12 18:32 ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Ben Greear

From: Ben Greear <greearb@candelatech.com>

In case firmware fails to start the scan, then complete
the start condition and clean up so that driver does not
block on timeout.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 11 +++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 249107d..924879f 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2375,6 +2375,17 @@ static int ath10k_start_scan(struct ath10k *ar,
 		return -ETIMEDOUT;
 	}
 
+	/* If we failed to start the scan, return error code at
+	 * this point.  This is probably due to some issue in the
+	 * firmware, but no need to wedge the driver due to that...
+	 */
+	spin_lock_bh(&ar->data_lock);
+	if (ar->scan.state == ATH10K_SCAN_IDLE) {
+		spin_unlock_bh(&ar->data_lock);
+		return -EINVAL;
+	}
+	spin_unlock_bh(&ar->data_lock);
+
 	/* Add a 200ms margin to account for event/command processing */
 	ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout,
 				     msecs_to_jiffies(arg->max_scan_time+200));
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 6e4ece0..203bcb9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -916,6 +916,25 @@ static void ath10k_wmi_event_scan_started(struct ath10k *ar)
 	}
 }
 
+static void ath10k_wmi_event_scan_start_failed(struct ath10k *ar)
+{
+	lockdep_assert_held(&ar->data_lock);
+
+	switch (ar->scan.state) {
+	case ATH10K_SCAN_IDLE:
+	case ATH10K_SCAN_RUNNING:
+	case ATH10K_SCAN_ABORTING:
+		ath10k_warn(ar, "received scan start failed event in an invalid scan state: %s (%d)\n",
+			    ath10k_scan_state_str(ar->scan.state),
+			    ar->scan.state);
+		break;
+	case ATH10K_SCAN_STARTING:
+		complete(&ar->scan.started);
+		__ath10k_scan_finish(ar);
+		break;
+	}
+}
+
 static void ath10k_wmi_event_scan_completed(struct ath10k *ar)
 {
 	lockdep_assert_held(&ar->data_lock);
@@ -1057,6 +1076,7 @@ static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
 		break;
 	case WMI_SCAN_EVENT_START_FAILED:
 		ath10k_warn(ar, "received scan start failure event\n");
+		ath10k_wmi_event_scan_start_failed(ar);
 		break;
 	case WMI_SCAN_EVENT_DEQUEUED:
 	case WMI_SCAN_EVENT_PREEMPTED:
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-01-12 18:32 ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: Ben Greear, linux-wireless

From: Ben Greear <greearb@candelatech.com>

In case firmware fails to start the scan, then complete
the start condition and clean up so that driver does not
block on timeout.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 11 +++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 249107d..924879f 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2375,6 +2375,17 @@ static int ath10k_start_scan(struct ath10k *ar,
 		return -ETIMEDOUT;
 	}
 
+	/* If we failed to start the scan, return error code at
+	 * this point.  This is probably due to some issue in the
+	 * firmware, but no need to wedge the driver due to that...
+	 */
+	spin_lock_bh(&ar->data_lock);
+	if (ar->scan.state == ATH10K_SCAN_IDLE) {
+		spin_unlock_bh(&ar->data_lock);
+		return -EINVAL;
+	}
+	spin_unlock_bh(&ar->data_lock);
+
 	/* Add a 200ms margin to account for event/command processing */
 	ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout,
 				     msecs_to_jiffies(arg->max_scan_time+200));
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 6e4ece0..203bcb9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -916,6 +916,25 @@ static void ath10k_wmi_event_scan_started(struct ath10k *ar)
 	}
 }
 
+static void ath10k_wmi_event_scan_start_failed(struct ath10k *ar)
+{
+	lockdep_assert_held(&ar->data_lock);
+
+	switch (ar->scan.state) {
+	case ATH10K_SCAN_IDLE:
+	case ATH10K_SCAN_RUNNING:
+	case ATH10K_SCAN_ABORTING:
+		ath10k_warn(ar, "received scan start failed event in an invalid scan state: %s (%d)\n",
+			    ath10k_scan_state_str(ar->scan.state),
+			    ar->scan.state);
+		break;
+	case ATH10K_SCAN_STARTING:
+		complete(&ar->scan.started);
+		__ath10k_scan_finish(ar);
+		break;
+	}
+}
+
 static void ath10k_wmi_event_scan_completed(struct ath10k *ar)
 {
 	lockdep_assert_held(&ar->data_lock);
@@ -1057,6 +1076,7 @@ static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
 		break;
 	case WMI_SCAN_EVENT_START_FAILED:
 		ath10k_warn(ar, "received scan start failure event\n");
+		ath10k_wmi_event_scan_start_failed(ar);
 		break;
 	case WMI_SCAN_EVENT_DEQUEUED:
 	case WMI_SCAN_EVENT_PREEMPTED:
-- 
1.7.11.7


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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 2/8] ath10k:  add wmi-id to htc credits debugging.
  2015-01-12 18:32 ` greearb
@ 2015-01-12 18:32   ` greearb
  -1 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Ben Greear

From: Ben Greear <greearb@candelatech.com>

This helps when trying to figure out exactly which commands
are consuming credits when trying to debug wmi credit hangs.
---
 drivers/net/wireless/ath/ath10k/htc.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index d56e7f6..16b939a 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -137,9 +137,18 @@ int ath10k_htc_send(struct ath10k_htc *htc,
 			goto err_pull;
 		}
 		ep->tx_credits -= credits;
-		ath10k_dbg(ar, ATH10K_DBG_HTC,
-			   "htc ep %d consumed %d credits (total %d)\n",
-			   eid, credits, ep->tx_credits);
+		if (eid == ar->wmi.eid) {
+			struct wmi_cmd_hdr* hdr;
+			hdr = (struct wmi_cmd_hdr*)(skb->data + sizeof(struct ath10k_htc_hdr));
+			ath10k_dbg(ar, ATH10K_DBG_HTC,
+				   "htc ep %d consumed %d credits (total %d, wmi-cmd 0x%x)\n",
+				   eid, credits, ep->tx_credits, __le32_to_cpu(hdr->cmd_id));
+		}
+		else {
+			ath10k_dbg(ar, ATH10K_DBG_HTC,
+				   "htc ep %d consumed %d credits (total %d)\n",
+				   eid, credits, ep->tx_credits);
+		}
 		spin_unlock_bh(&htc->tx_lock);
 	}
 
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 2/8] ath10k:  add wmi-id to htc credits debugging.
@ 2015-01-12 18:32   ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: Ben Greear, linux-wireless

From: Ben Greear <greearb@candelatech.com>

This helps when trying to figure out exactly which commands
are consuming credits when trying to debug wmi credit hangs.
---
 drivers/net/wireless/ath/ath10k/htc.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index d56e7f6..16b939a 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -137,9 +137,18 @@ int ath10k_htc_send(struct ath10k_htc *htc,
 			goto err_pull;
 		}
 		ep->tx_credits -= credits;
-		ath10k_dbg(ar, ATH10K_DBG_HTC,
-			   "htc ep %d consumed %d credits (total %d)\n",
-			   eid, credits, ep->tx_credits);
+		if (eid == ar->wmi.eid) {
+			struct wmi_cmd_hdr* hdr;
+			hdr = (struct wmi_cmd_hdr*)(skb->data + sizeof(struct ath10k_htc_hdr));
+			ath10k_dbg(ar, ATH10K_DBG_HTC,
+				   "htc ep %d consumed %d credits (total %d, wmi-cmd 0x%x)\n",
+				   eid, credits, ep->tx_credits, __le32_to_cpu(hdr->cmd_id));
+		}
+		else {
+			ath10k_dbg(ar, ATH10K_DBG_HTC,
+				   "htc ep %d consumed %d credits (total %d)\n",
+				   eid, credits, ep->tx_credits);
+		}
 		spin_unlock_bh(&htc->tx_lock);
 	}
 
-- 
1.7.11.7


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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 3/8] ath10k:  fix spelling mistakes and add details to mac logging.
  2015-01-12 18:32 ` greearb
@ 2015-01-12 18:32   ` greearb
  -1 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Ben Greear

From: Ben Greear <greearb@candelatech.com>

A bit of general cleanup to make debug messages more useful.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 924879f..85abb8a 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -604,7 +604,7 @@ static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
 
 	ret = ath10k_vdev_setup_sync(ar);
 	if (ret) {
-		ath10k_warn(ar, "failed to synchronize setup for monitor vdev %i: %d\n",
+		ath10k_warn(ar, "failed to synchronize setup for monitor vdev %i: %d (start)\n",
 			    vdev_id, ret);
 		return ret;
 	}
@@ -651,7 +651,7 @@ static int ath10k_monitor_vdev_stop(struct ath10k *ar)
 
 	ret = ath10k_vdev_setup_sync(ar);
 	if (ret)
-		ath10k_warn(ar, "failed to synchronise monitor vdev %i: %d\n",
+		ath10k_warn(ar, "failed to synchronize monitor vdev %i: %d (stop)\n",
 			    ar->monitor_vdev_id, ret);
 
 	ath10k_dbg(ar, ATH10K_DBG_MAC, "mac monitor vdev %i stopped\n",
@@ -936,8 +936,8 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif, bool restart)
 
 	ret = ath10k_vdev_setup_sync(ar);
 	if (ret) {
-		ath10k_warn(ar, "failed to synchronise setup for vdev %i: %d\n",
-			    arg.vdev_id, ret);
+		ath10k_warn(ar, "failed to synchronize setup for vdev %i: %d (restart %d)\n",
+			    arg.vdev_id, ret, restart);
 		return ret;
 	}
 
@@ -975,7 +975,7 @@ static int ath10k_vdev_stop(struct ath10k_vif *arvif)
 
 	ret = ath10k_vdev_setup_sync(ar);
 	if (ret) {
-		ath10k_warn(ar, "failed to syncronise setup for vdev %i: %d\n",
+		ath10k_warn(ar, "failed to synchronize setup for vdev %i: %d (stop)\n",
 			    arvif->vdev_id, ret);
 		return ret;
 	}
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 3/8] ath10k: fix spelling mistakes and add details to mac logging.
@ 2015-01-12 18:32   ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: Ben Greear, linux-wireless

From: Ben Greear <greearb@candelatech.com>

A bit of general cleanup to make debug messages more useful.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 924879f..85abb8a 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -604,7 +604,7 @@ static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
 
 	ret = ath10k_vdev_setup_sync(ar);
 	if (ret) {
-		ath10k_warn(ar, "failed to synchronize setup for monitor vdev %i: %d\n",
+		ath10k_warn(ar, "failed to synchronize setup for monitor vdev %i: %d (start)\n",
 			    vdev_id, ret);
 		return ret;
 	}
@@ -651,7 +651,7 @@ static int ath10k_monitor_vdev_stop(struct ath10k *ar)
 
 	ret = ath10k_vdev_setup_sync(ar);
 	if (ret)
-		ath10k_warn(ar, "failed to synchronise monitor vdev %i: %d\n",
+		ath10k_warn(ar, "failed to synchronize monitor vdev %i: %d (stop)\n",
 			    ar->monitor_vdev_id, ret);
 
 	ath10k_dbg(ar, ATH10K_DBG_MAC, "mac monitor vdev %i stopped\n",
@@ -936,8 +936,8 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif, bool restart)
 
 	ret = ath10k_vdev_setup_sync(ar);
 	if (ret) {
-		ath10k_warn(ar, "failed to synchronise setup for vdev %i: %d\n",
-			    arg.vdev_id, ret);
+		ath10k_warn(ar, "failed to synchronize setup for vdev %i: %d (restart %d)\n",
+			    arg.vdev_id, ret, restart);
 		return ret;
 	}
 
@@ -975,7 +975,7 @@ static int ath10k_vdev_stop(struct ath10k_vif *arvif)
 
 	ret = ath10k_vdev_setup_sync(ar);
 	if (ret) {
-		ath10k_warn(ar, "failed to syncronise setup for vdev %i: %d\n",
+		ath10k_warn(ar, "failed to synchronize setup for vdev %i: %d (stop)\n",
 			    arvif->vdev_id, ret);
 		return ret;
 	}
-- 
1.7.11.7


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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 4/8] ath10k:  make dbglog debug messages be 'warn' level.
  2015-01-12 18:32 ` greearb
@ 2015-01-12 18:32   ` greearb
  -1 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Ben Greear

From: Ben Greear <greearb@candelatech.com>

This only happens on firmware crash, and it appears this
logic is not always perfect, so make sure the information
is printed to logs at higher level.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 0f7e845..dee0d5a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1132,9 +1132,8 @@ static void ath10k_pci_dump_dbglog(struct ath10k *ar)
 		return;
 	}
 
-	ath10k_dbg(ar, ATH10K_DBG_PCI,
-		   "debug log header, dbuf: 0x%x  dropped: %i\n",
-		   le32_to_cpu(dbg_hdr.dbuf), le32_to_cpu(dbg_hdr.dropped));
+	ath10k_warn(ar, "debug log header, dbuf: 0x%x  dropped: %i\n",
+		    le32_to_cpu(dbg_hdr.dbuf), le32_to_cpu(dbg_hdr.dropped));
 	dbufp = le32_to_cpu(dbg_hdr.dbuf);
 
 	/* i is for logging purposes and sanity check in case firmware buffers
@@ -1154,11 +1153,10 @@ static void ath10k_pci_dump_dbglog(struct ath10k *ar)
 
 		len = le32_to_cpu(dbuf.length);
 
-		ath10k_dbg(ar, ATH10K_DBG_PCI,
-			   "[%i] next: 0x%x buf: 0x%x sz: %i len: %i count: %i free: %i\n",
-			   i, le32_to_cpu(dbuf.next), le32_to_cpu(dbuf.buffer),
-			   le32_to_cpu(dbuf.bufsize), len,
-			   le32_to_cpu(dbuf.count), le32_to_cpu(dbuf.free));
+		ath10k_warn(ar, "[%i] next: 0x%x buf: 0x%x sz: %i len: %i count: %i free: %i\n",
+			    i, le32_to_cpu(dbuf.next), le32_to_cpu(dbuf.buffer),
+			    le32_to_cpu(dbuf.bufsize), len,
+			    le32_to_cpu(dbuf.count), le32_to_cpu(dbuf.free));
 		if (dbuf.buffer == 0 || len == 0)
 			goto next;
 
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 4/8] ath10k:  make dbglog debug messages be 'warn' level.
@ 2015-01-12 18:32   ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: Ben Greear, linux-wireless

From: Ben Greear <greearb@candelatech.com>

This only happens on firmware crash, and it appears this
logic is not always perfect, so make sure the information
is printed to logs at higher level.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 0f7e845..dee0d5a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1132,9 +1132,8 @@ static void ath10k_pci_dump_dbglog(struct ath10k *ar)
 		return;
 	}
 
-	ath10k_dbg(ar, ATH10K_DBG_PCI,
-		   "debug log header, dbuf: 0x%x  dropped: %i\n",
-		   le32_to_cpu(dbg_hdr.dbuf), le32_to_cpu(dbg_hdr.dropped));
+	ath10k_warn(ar, "debug log header, dbuf: 0x%x  dropped: %i\n",
+		    le32_to_cpu(dbg_hdr.dbuf), le32_to_cpu(dbg_hdr.dropped));
 	dbufp = le32_to_cpu(dbg_hdr.dbuf);
 
 	/* i is for logging purposes and sanity check in case firmware buffers
@@ -1154,11 +1153,10 @@ static void ath10k_pci_dump_dbglog(struct ath10k *ar)
 
 		len = le32_to_cpu(dbuf.length);
 
-		ath10k_dbg(ar, ATH10K_DBG_PCI,
-			   "[%i] next: 0x%x buf: 0x%x sz: %i len: %i count: %i free: %i\n",
-			   i, le32_to_cpu(dbuf.next), le32_to_cpu(dbuf.buffer),
-			   le32_to_cpu(dbuf.bufsize), len,
-			   le32_to_cpu(dbuf.count), le32_to_cpu(dbuf.free));
+		ath10k_warn(ar, "[%i] next: 0x%x buf: 0x%x sz: %i len: %i count: %i free: %i\n",
+			    i, le32_to_cpu(dbuf.next), le32_to_cpu(dbuf.buffer),
+			    le32_to_cpu(dbuf.bufsize), len,
+			    le32_to_cpu(dbuf.count), le32_to_cpu(dbuf.free));
 		if (dbuf.buffer == 0 || len == 0)
 			goto next;
 
-- 
1.7.11.7


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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 5/8] ath10k:  add firmware wmi keep-alive message.
  2015-01-12 18:32 ` greearb
@ 2015-01-12 18:32   ` greearb
  -1 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Ben Greear

From: Ben Greear <greearb@candelatech.com>

Only useful for CT firmware.

This sends a wmi message to the firmware every 2 seconds or so.
Once CT firmware receives one of these messages, it will assert
if it does not receive more within a 10 second window.

This helps debug and work-around wmi transport hangs.

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

This is for comment only, as it requires at least minimal CT firmware support
patches in order to compile or work.

 drivers/net/wireless/ath/ath10k/core.h  |  2 ++
 drivers/net/wireless/ath/ath10k/debug.c | 29 +++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c   | 32 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h   |  7 +++++++
 4 files changed, 70 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index a16cadd..f3729bc 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -367,6 +367,7 @@ struct ath10k_debug {
 
 	unsigned long htt_stats_mask;
 	struct delayed_work htt_stats_dwork;
+	struct delayed_work nop_dwork;
 	struct ath10k_dfs_stats dfs_stats;
 	struct ath_dfs_pool_stats dfs_pool_stats;
 
@@ -374,6 +375,7 @@ struct ath10k_debug {
 	u32 fw_dbglog_mask;
 	u32 pktlog_filter;
 	u32 reg_addr;
+	u32 nop_id;
 
 	u8 htt_max_amsdu;
 	u8 htt_max_ampdu;
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 92c8488..f419e88 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -27,6 +27,8 @@
 /* ms */
 #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000
 
+#define ATH10K_DEBUG_NOP_INTERVAL 2000 /* ms */
+
 #define ATH10K_FW_CRASH_DUMP_VERSION 1
 
 /**
@@ -1550,6 +1552,27 @@ static void ath10k_debug_htt_stats_dwork(struct work_struct *work)
 	mutex_unlock(&ar->conf_mutex);
 }
 
+static void ath10k_debug_nop_dwork(struct work_struct *work)
+{
+	struct ath10k *ar = container_of(work, struct ath10k,
+					 debug.nop_dwork.work);
+
+	mutex_lock(&ar->conf_mutex);
+
+	if (ar->state == ATH10K_STATE_ON) {
+		int ret = ath10k_wmi_request_nop(ar);
+		if (ret) {
+			ath10k_warn(ar, "failed to send wmi nop: %d\n", ret);
+		}
+	}
+
+	/* Re-arm periodic work. */
+	queue_delayed_work(ar->workqueue, &ar->debug.nop_dwork,
+			   msecs_to_jiffies(ATH10K_DEBUG_NOP_INTERVAL));
+
+	mutex_unlock(&ar->conf_mutex);
+}
+
 static ssize_t ath10k_read_htt_stats_mask(struct file *file,
 					  char __user *user_buf,
 					  size_t count, loff_t *ppos)
@@ -2192,6 +2215,11 @@ int ath10k_debug_register(struct ath10k *ar)
 		return -ENOMEM;
 	}
 
+	INIT_DELAYED_WORK(&ar->debug.nop_dwork, ath10k_debug_nop_dwork);
+
+	queue_delayed_work(ar->workqueue, &ar->debug.nop_dwork,
+			   msecs_to_jiffies(ATH10K_DEBUG_NOP_INTERVAL));
+
 	INIT_DELAYED_WORK(&ar->debug.htt_stats_dwork,
 			  ath10k_debug_htt_stats_dwork);
 
@@ -2262,6 +2290,7 @@ int ath10k_debug_register(struct ath10k *ar)
 
 void ath10k_debug_unregister(struct ath10k *ar)
 {
+	cancel_delayed_work_sync(&ar->debug.nop_dwork);
 	cancel_delayed_work_sync(&ar->debug.htt_stats_dwork);
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 203bcb9..5d3fe88 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4480,6 +4480,38 @@ int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id)
 	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->request_stats_cmdid);
 }
 
+#ifdef CONFIG_ATH10K_DEBUG
+/* CT firmware only:
+ * (re) start wmi keep-alive timer in firmware.  Once we start
+ * sending these, firmware will assert if it does not receive one
+ * after about 10 seconds.
+ */
+
+struct wmi_request_nop_cmd {
+	u32 nop_id; /* for debugging purposes */
+};
+
+int ath10k_wmi_request_nop(struct ath10k *ar)
+{
+	struct wmi_request_nop_cmd *cmd;
+	struct sk_buff *skb;
+
+	if (! test_bit(ATH10K_FW_FEATURE_WMI_10X_CT, ar->fw_features))
+		return 0;
+
+	skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+	if (!skb)
+		return -ENOMEM;
+
+	cmd = (struct wmi_request_nop_cmd *)skb->data;
+	cmd->nop_id = __cpu_to_le32(ar->debug.nop_id++);
+
+	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi request nop (id %d)\n",
+		   ar->debug.nop_id - 1);
+	return ath10k_wmi_cmd_send(ar, skb, WMI_NOP);
+}
+#endif
+
 int ath10k_wmi_force_fw_hang(struct ath10k *ar,
 			     enum wmi_force_fw_hang_type type, u32 delay_ms)
 {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 026a697..fc9f068 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -901,6 +901,8 @@ enum wmi_10x_cmd_id {
 	WMI_10X_GPIO_CONFIG_CMDID,
 	WMI_10X_GPIO_OUTPUT_CMDID,
 
+	WMI_NOP = WMI_10X_END_CMDID - 100, /* CT only:  wmi transport keep-alive, basically */
+
 	WMI_10X_PDEV_UTF_CMDID = WMI_10X_END_CMDID - 1,
 };
 
@@ -4736,4 +4738,9 @@ int ath10k_wmi_pull_fw_stats(struct ath10k *ar, struct sk_buff *skb,
 int ath10k_wmi_pdev_pktlog_enable(struct ath10k *ar, u32 ev_list);
 int ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar);
 
+#ifdef CONFIG_ATH10K_DEBUG
+/* CT Firmware only */
+int ath10k_wmi_request_nop(struct ath10k *ar);
+#endif
+
 #endif /* _WMI_H_ */
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RFC 5/8] ath10k:  add firmware wmi keep-alive message.
@ 2015-01-12 18:32   ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: Ben Greear, linux-wireless

From: Ben Greear <greearb@candelatech.com>

Only useful for CT firmware.

This sends a wmi message to the firmware every 2 seconds or so.
Once CT firmware receives one of these messages, it will assert
if it does not receive more within a 10 second window.

This helps debug and work-around wmi transport hangs.

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

This is for comment only, as it requires at least minimal CT firmware support
patches in order to compile or work.

 drivers/net/wireless/ath/ath10k/core.h  |  2 ++
 drivers/net/wireless/ath/ath10k/debug.c | 29 +++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c   | 32 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h   |  7 +++++++
 4 files changed, 70 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index a16cadd..f3729bc 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -367,6 +367,7 @@ struct ath10k_debug {
 
 	unsigned long htt_stats_mask;
 	struct delayed_work htt_stats_dwork;
+	struct delayed_work nop_dwork;
 	struct ath10k_dfs_stats dfs_stats;
 	struct ath_dfs_pool_stats dfs_pool_stats;
 
@@ -374,6 +375,7 @@ struct ath10k_debug {
 	u32 fw_dbglog_mask;
 	u32 pktlog_filter;
 	u32 reg_addr;
+	u32 nop_id;
 
 	u8 htt_max_amsdu;
 	u8 htt_max_ampdu;
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 92c8488..f419e88 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -27,6 +27,8 @@
 /* ms */
 #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000
 
+#define ATH10K_DEBUG_NOP_INTERVAL 2000 /* ms */
+
 #define ATH10K_FW_CRASH_DUMP_VERSION 1
 
 /**
@@ -1550,6 +1552,27 @@ static void ath10k_debug_htt_stats_dwork(struct work_struct *work)
 	mutex_unlock(&ar->conf_mutex);
 }
 
+static void ath10k_debug_nop_dwork(struct work_struct *work)
+{
+	struct ath10k *ar = container_of(work, struct ath10k,
+					 debug.nop_dwork.work);
+
+	mutex_lock(&ar->conf_mutex);
+
+	if (ar->state == ATH10K_STATE_ON) {
+		int ret = ath10k_wmi_request_nop(ar);
+		if (ret) {
+			ath10k_warn(ar, "failed to send wmi nop: %d\n", ret);
+		}
+	}
+
+	/* Re-arm periodic work. */
+	queue_delayed_work(ar->workqueue, &ar->debug.nop_dwork,
+			   msecs_to_jiffies(ATH10K_DEBUG_NOP_INTERVAL));
+
+	mutex_unlock(&ar->conf_mutex);
+}
+
 static ssize_t ath10k_read_htt_stats_mask(struct file *file,
 					  char __user *user_buf,
 					  size_t count, loff_t *ppos)
@@ -2192,6 +2215,11 @@ int ath10k_debug_register(struct ath10k *ar)
 		return -ENOMEM;
 	}
 
+	INIT_DELAYED_WORK(&ar->debug.nop_dwork, ath10k_debug_nop_dwork);
+
+	queue_delayed_work(ar->workqueue, &ar->debug.nop_dwork,
+			   msecs_to_jiffies(ATH10K_DEBUG_NOP_INTERVAL));
+
 	INIT_DELAYED_WORK(&ar->debug.htt_stats_dwork,
 			  ath10k_debug_htt_stats_dwork);
 
@@ -2262,6 +2290,7 @@ int ath10k_debug_register(struct ath10k *ar)
 
 void ath10k_debug_unregister(struct ath10k *ar)
 {
+	cancel_delayed_work_sync(&ar->debug.nop_dwork);
 	cancel_delayed_work_sync(&ar->debug.htt_stats_dwork);
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 203bcb9..5d3fe88 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4480,6 +4480,38 @@ int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id)
 	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->request_stats_cmdid);
 }
 
+#ifdef CONFIG_ATH10K_DEBUG
+/* CT firmware only:
+ * (re) start wmi keep-alive timer in firmware.  Once we start
+ * sending these, firmware will assert if it does not receive one
+ * after about 10 seconds.
+ */
+
+struct wmi_request_nop_cmd {
+	u32 nop_id; /* for debugging purposes */
+};
+
+int ath10k_wmi_request_nop(struct ath10k *ar)
+{
+	struct wmi_request_nop_cmd *cmd;
+	struct sk_buff *skb;
+
+	if (! test_bit(ATH10K_FW_FEATURE_WMI_10X_CT, ar->fw_features))
+		return 0;
+
+	skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+	if (!skb)
+		return -ENOMEM;
+
+	cmd = (struct wmi_request_nop_cmd *)skb->data;
+	cmd->nop_id = __cpu_to_le32(ar->debug.nop_id++);
+
+	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi request nop (id %d)\n",
+		   ar->debug.nop_id - 1);
+	return ath10k_wmi_cmd_send(ar, skb, WMI_NOP);
+}
+#endif
+
 int ath10k_wmi_force_fw_hang(struct ath10k *ar,
 			     enum wmi_force_fw_hang_type type, u32 delay_ms)
 {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 026a697..fc9f068 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -901,6 +901,8 @@ enum wmi_10x_cmd_id {
 	WMI_10X_GPIO_CONFIG_CMDID,
 	WMI_10X_GPIO_OUTPUT_CMDID,
 
+	WMI_NOP = WMI_10X_END_CMDID - 100, /* CT only:  wmi transport keep-alive, basically */
+
 	WMI_10X_PDEV_UTF_CMDID = WMI_10X_END_CMDID - 1,
 };
 
@@ -4736,4 +4738,9 @@ int ath10k_wmi_pull_fw_stats(struct ath10k *ar, struct sk_buff *skb,
 int ath10k_wmi_pdev_pktlog_enable(struct ath10k *ar, u32 ev_list);
 int ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar);
 
+#ifdef CONFIG_ATH10K_DEBUG
+/* CT Firmware only */
+int ath10k_wmi_request_nop(struct ath10k *ar);
+#endif
+
 #endif /* _WMI_H_ */
-- 
1.7.11.7


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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 6/8] ath10k:  fix spelling in htt code comment.
  2015-01-12 18:32 ` greearb
@ 2015-01-12 18:32   ` greearb
  -1 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Ben Greear

From: Ben Greear <greearb@candelatech.com>

Fix spelling error.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index fdd665c..a3ca25c 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -130,7 +130,7 @@ static void ath10k_htt_rx_msdu_buff_replenish(struct ath10k_htt *htt)
 	 * automatically balances load wrt to CPU power.
 	 *
 	 * This probably comes at a cost of lower maximum throughput but
-	 * improves the avarage and stability. */
+	 * improves the average and stability. */
 	spin_lock_bh(&htt->rx_ring.lock);
 	num_deficit = htt->rx_ring.fill_level - htt->rx_ring.fill_cnt;
 	num_to_fill = min(ATH10K_HTT_MAX_NUM_REFILL, num_deficit);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 6/8] ath10k:  fix spelling in htt code comment.
@ 2015-01-12 18:32   ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: Ben Greear, linux-wireless

From: Ben Greear <greearb@candelatech.com>

Fix spelling error.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index fdd665c..a3ca25c 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -130,7 +130,7 @@ static void ath10k_htt_rx_msdu_buff_replenish(struct ath10k_htt *htt)
 	 * automatically balances load wrt to CPU power.
 	 *
 	 * This probably comes at a cost of lower maximum throughput but
-	 * improves the avarage and stability. */
+	 * improves the average and stability. */
 	spin_lock_bh(&htt->rx_ring.lock);
 	num_deficit = htt->rx_ring.fill_level - htt->rx_ring.fill_cnt;
 	num_to_fill = min(ATH10K_HTT_MAX_NUM_REFILL, num_deficit);
-- 
1.7.11.7


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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 7/8] ath10k:  start using htt/pci/ce transfer_id properly.
  2015-01-12 18:32 ` greearb
@ 2015-01-12 18:32   ` greearb
  -1 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Ben Greear

From: Ben Greear <greearb@candelatech.com>

Upstream firmware may ingore, but someone hacking on firmware
can use this (and similar instrumentation on the firmware side)
to help determine what is happening when there are communication
issues between firmware and host.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/ce.c     |  1 +
 drivers/net/wireless/ath/ath10k/ce.h     |  7 +++++++
 drivers/net/wireless/ath/ath10k/htc.c    |  2 +-
 drivers/net/wireless/ath/ath10k/htc.h    |  1 +
 drivers/net/wireless/ath/ath10k/htt.h    |  1 +
 drivers/net/wireless/ath/ath10k/htt_tx.c |  6 ++++--
 drivers/net/wireless/ath/ath10k/pci.c    | 31 +++++++++++++++++++++++--------
 7 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index a156e6e..ecc6d0c 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -319,6 +319,7 @@ int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
 		ath10k_ce_src_ring_write_index_set(ar, ctrl_addr, write_index);
 
 	src_ring->write_index = write_index;
+	ce_state->last_tx_transfer_id = transfer_id;
 exit:
 	return ret;
 }
diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
index 617a151..f4919e9 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -120,6 +120,13 @@ struct ath10k_ce_pipe {
 	unsigned int src_sz_max;
 	struct ath10k_ce_ring *src_ring;
 	struct ath10k_ce_ring *dest_ring;
+
+	/* Some fields used for debugging */
+	unsigned int last_rx_transfer_id;
+	unsigned int last_ce_send_done_transfer_id;
+	unsigned int last_tx_transfer_id;
+	unsigned int last_bmi_send_done_transfer_id;
+	unsigned int last_bmi_recv_transfer_id;
 };
 
 /* Copy Engine settable attributes */
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 16b939a..97139ce 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -160,7 +160,7 @@ int ath10k_htc_send(struct ath10k_htc *htc,
 	if (ret)
 		goto err_credits;
 
-	sg_item.transfer_id = ep->eid;
+	sg_item.transfer_id = ep->next_transfer_id++;
 	sg_item.transfer_context = skb;
 	sg_item.vaddr = skb->data;
 	sg_item.paddr = skb_cb->paddr;
diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h
index 527179c..db99593 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -316,6 +316,7 @@ struct ath10k_htc_ep {
 	int dl_is_polled; /* call HIF to fetch rx (not implemented) */
 
 	u8 seq_no; /* for debugging */
+	u16 next_transfer_id; /* for debugging */
 	int tx_credits;
 	int tx_credit_size;
 	int tx_credits_per_max_message;
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index 4dede95..5ebf968 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1223,6 +1223,7 @@ struct ath10k_htt {
 	int max_throughput_mbps;
 	u8 target_version_major;
 	u8 target_version_minor;
+	u16 htt_transfer_id;
 	struct completion target_version_received;
 
 	struct {
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index b7937b9..bd1236e 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -456,6 +456,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 	dma_addr_t paddr;
 	u32 frags_paddr;
 	bool use_frags;
+	unsigned int htt_transfer_id;
 
 	res = ath10k_htt_tx_inc_pending(htt);
 	if (res)
@@ -469,6 +470,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 	}
 	msdu_id = res;
 	htt->pending_tx[msdu_id] = msdu;
+	htt_transfer_id = htt->htt_transfer_id++;
 	spin_unlock_bh(&htt->tx_lock);
 
 	prefetch_len = min(htt->prefetch_len, msdu->len);
@@ -569,7 +571,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 	trace_ath10k_tx_hdr(ar, msdu->data, msdu->len);
 	trace_ath10k_tx_payload(ar, msdu->data, msdu->len);
 
-	sg_items[0].transfer_id = 0;
+	sg_items[0].transfer_id = htt_transfer_id;
 	sg_items[0].transfer_context = NULL;
 	sg_items[0].vaddr = &skb_cb->htt.txbuf->htc_hdr;
 	sg_items[0].paddr = skb_cb->htt.txbuf_paddr +
@@ -578,7 +580,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 			  sizeof(skb_cb->htt.txbuf->cmd_hdr) +
 			  sizeof(skb_cb->htt.txbuf->cmd_tx);
 
-	sg_items[1].transfer_id = 0;
+	sg_items[1].transfer_id = sg_items[0].transfer_id;
 	sg_items[1].transfer_context = NULL;
 	sg_items[1].vaddr = msdu->data;
 	sg_items[1].paddr = skb_cb->paddr;
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index dee0d5a..b35590e 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -846,11 +846,11 @@ static void ath10k_pci_ce_send_done(struct ath10k_ce_pipe *ce_state)
 	struct sk_buff *skb;
 	u32 ce_data;
 	unsigned int nbytes;
-	unsigned int transfer_id;
 
 	__skb_queue_head_init(&list);
 	while (ath10k_ce_completed_send_next(ce_state, (void **)&skb, &ce_data,
-					     &nbytes, &transfer_id) == 0) {
+					     &nbytes,
+					     &ce_state->last_ce_send_done_transfer_id) == 0) {
 		/* no need to call tx completion for NULL pointers */
 		if (skb == NULL)
 			continue;
@@ -874,12 +874,11 @@ static void ath10k_pci_ce_recv_data(struct ath10k_ce_pipe *ce_state)
 	void *transfer_context;
 	u32 ce_data;
 	unsigned int nbytes, max_nbytes;
-	unsigned int transfer_id;
 	unsigned int flags;
 
 	__skb_queue_head_init(&list);
 	while (ath10k_ce_completed_recv_next(ce_state, &transfer_context,
-					     &ce_data, &nbytes, &transfer_id,
+					     &ce_data, &nbytes, &ce_state->last_rx_transfer_id,
 					     &flags) == 0) {
 		skb = transfer_context;
 		max_nbytes = skb->len + skb_tailroom(skb);
@@ -1209,6 +1208,8 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
 {
 	struct ath10k_fw_crash_data *crash_data;
 	char uuid[50];
+	struct ath10k_pci *pci;
+	int i;
 
 	spin_lock_bh(&ar->data_lock);
 
@@ -1234,6 +1235,19 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
 
 	spin_unlock_bh(&ar->data_lock);
 
+	/* Print out some info on the CE pipes */
+	pci = ath10k_pci_priv(ar);
+	for (i = 0; i<CE_COUNT_MAX; i++) {
+		ath10k_err(ar, "ce-pipe [%i] rx-id: %i  ce-send-done: %d tx-id: %d bmi-send-done: %d bmi-recv: %d\n",
+			   i,
+			   pci->ce_states[i].last_rx_transfer_id,
+			   pci->ce_states[i].last_ce_send_done_transfer_id,
+			   pci->ce_states[i].last_tx_transfer_id,
+			   pci->ce_states[i].last_bmi_send_done_transfer_id,
+			   pci->ce_states[i].last_bmi_recv_transfer_id);
+	}
+	ath10k_err(ar, "last htt-tx-id: %d\n", ar->htt.htt_transfer_id);
+
 	queue_work(ar->workqueue, &ar->restart_work);
 }
 
@@ -1640,10 +1654,10 @@ static void ath10k_pci_bmi_send_done(struct ath10k_ce_pipe *ce_state)
 	struct bmi_xfer *xfer;
 	u32 ce_data;
 	unsigned int nbytes;
-	unsigned int transfer_id;
 
 	if (ath10k_ce_completed_send_next(ce_state, (void **)&xfer, &ce_data,
-					  &nbytes, &transfer_id))
+					  &nbytes,
+					  &ce_state->last_bmi_send_done_transfer_id))
 		return;
 
 	xfer->tx_done = true;
@@ -1655,11 +1669,12 @@ static void ath10k_pci_bmi_recv_data(struct ath10k_ce_pipe *ce_state)
 	struct bmi_xfer *xfer;
 	u32 ce_data;
 	unsigned int nbytes;
-	unsigned int transfer_id;
 	unsigned int flags;
 
 	if (ath10k_ce_completed_recv_next(ce_state, (void **)&xfer, &ce_data,
-					  &nbytes, &transfer_id, &flags))
+					  &nbytes,
+					  &ce_state->last_bmi_recv_transfer_id,
+					  &flags))
 		return;
 
 	if (WARN_ON_ONCE(!xfer))
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 7/8] ath10k:  start using htt/pci/ce transfer_id properly.
@ 2015-01-12 18:32   ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: Ben Greear, linux-wireless

From: Ben Greear <greearb@candelatech.com>

Upstream firmware may ingore, but someone hacking on firmware
can use this (and similar instrumentation on the firmware side)
to help determine what is happening when there are communication
issues between firmware and host.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/ce.c     |  1 +
 drivers/net/wireless/ath/ath10k/ce.h     |  7 +++++++
 drivers/net/wireless/ath/ath10k/htc.c    |  2 +-
 drivers/net/wireless/ath/ath10k/htc.h    |  1 +
 drivers/net/wireless/ath/ath10k/htt.h    |  1 +
 drivers/net/wireless/ath/ath10k/htt_tx.c |  6 ++++--
 drivers/net/wireless/ath/ath10k/pci.c    | 31 +++++++++++++++++++++++--------
 7 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index a156e6e..ecc6d0c 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -319,6 +319,7 @@ int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
 		ath10k_ce_src_ring_write_index_set(ar, ctrl_addr, write_index);
 
 	src_ring->write_index = write_index;
+	ce_state->last_tx_transfer_id = transfer_id;
 exit:
 	return ret;
 }
diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
index 617a151..f4919e9 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -120,6 +120,13 @@ struct ath10k_ce_pipe {
 	unsigned int src_sz_max;
 	struct ath10k_ce_ring *src_ring;
 	struct ath10k_ce_ring *dest_ring;
+
+	/* Some fields used for debugging */
+	unsigned int last_rx_transfer_id;
+	unsigned int last_ce_send_done_transfer_id;
+	unsigned int last_tx_transfer_id;
+	unsigned int last_bmi_send_done_transfer_id;
+	unsigned int last_bmi_recv_transfer_id;
 };
 
 /* Copy Engine settable attributes */
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 16b939a..97139ce 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -160,7 +160,7 @@ int ath10k_htc_send(struct ath10k_htc *htc,
 	if (ret)
 		goto err_credits;
 
-	sg_item.transfer_id = ep->eid;
+	sg_item.transfer_id = ep->next_transfer_id++;
 	sg_item.transfer_context = skb;
 	sg_item.vaddr = skb->data;
 	sg_item.paddr = skb_cb->paddr;
diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h
index 527179c..db99593 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -316,6 +316,7 @@ struct ath10k_htc_ep {
 	int dl_is_polled; /* call HIF to fetch rx (not implemented) */
 
 	u8 seq_no; /* for debugging */
+	u16 next_transfer_id; /* for debugging */
 	int tx_credits;
 	int tx_credit_size;
 	int tx_credits_per_max_message;
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index 4dede95..5ebf968 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1223,6 +1223,7 @@ struct ath10k_htt {
 	int max_throughput_mbps;
 	u8 target_version_major;
 	u8 target_version_minor;
+	u16 htt_transfer_id;
 	struct completion target_version_received;
 
 	struct {
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index b7937b9..bd1236e 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -456,6 +456,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 	dma_addr_t paddr;
 	u32 frags_paddr;
 	bool use_frags;
+	unsigned int htt_transfer_id;
 
 	res = ath10k_htt_tx_inc_pending(htt);
 	if (res)
@@ -469,6 +470,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 	}
 	msdu_id = res;
 	htt->pending_tx[msdu_id] = msdu;
+	htt_transfer_id = htt->htt_transfer_id++;
 	spin_unlock_bh(&htt->tx_lock);
 
 	prefetch_len = min(htt->prefetch_len, msdu->len);
@@ -569,7 +571,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 	trace_ath10k_tx_hdr(ar, msdu->data, msdu->len);
 	trace_ath10k_tx_payload(ar, msdu->data, msdu->len);
 
-	sg_items[0].transfer_id = 0;
+	sg_items[0].transfer_id = htt_transfer_id;
 	sg_items[0].transfer_context = NULL;
 	sg_items[0].vaddr = &skb_cb->htt.txbuf->htc_hdr;
 	sg_items[0].paddr = skb_cb->htt.txbuf_paddr +
@@ -578,7 +580,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 			  sizeof(skb_cb->htt.txbuf->cmd_hdr) +
 			  sizeof(skb_cb->htt.txbuf->cmd_tx);
 
-	sg_items[1].transfer_id = 0;
+	sg_items[1].transfer_id = sg_items[0].transfer_id;
 	sg_items[1].transfer_context = NULL;
 	sg_items[1].vaddr = msdu->data;
 	sg_items[1].paddr = skb_cb->paddr;
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index dee0d5a..b35590e 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -846,11 +846,11 @@ static void ath10k_pci_ce_send_done(struct ath10k_ce_pipe *ce_state)
 	struct sk_buff *skb;
 	u32 ce_data;
 	unsigned int nbytes;
-	unsigned int transfer_id;
 
 	__skb_queue_head_init(&list);
 	while (ath10k_ce_completed_send_next(ce_state, (void **)&skb, &ce_data,
-					     &nbytes, &transfer_id) == 0) {
+					     &nbytes,
+					     &ce_state->last_ce_send_done_transfer_id) == 0) {
 		/* no need to call tx completion for NULL pointers */
 		if (skb == NULL)
 			continue;
@@ -874,12 +874,11 @@ static void ath10k_pci_ce_recv_data(struct ath10k_ce_pipe *ce_state)
 	void *transfer_context;
 	u32 ce_data;
 	unsigned int nbytes, max_nbytes;
-	unsigned int transfer_id;
 	unsigned int flags;
 
 	__skb_queue_head_init(&list);
 	while (ath10k_ce_completed_recv_next(ce_state, &transfer_context,
-					     &ce_data, &nbytes, &transfer_id,
+					     &ce_data, &nbytes, &ce_state->last_rx_transfer_id,
 					     &flags) == 0) {
 		skb = transfer_context;
 		max_nbytes = skb->len + skb_tailroom(skb);
@@ -1209,6 +1208,8 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
 {
 	struct ath10k_fw_crash_data *crash_data;
 	char uuid[50];
+	struct ath10k_pci *pci;
+	int i;
 
 	spin_lock_bh(&ar->data_lock);
 
@@ -1234,6 +1235,19 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
 
 	spin_unlock_bh(&ar->data_lock);
 
+	/* Print out some info on the CE pipes */
+	pci = ath10k_pci_priv(ar);
+	for (i = 0; i<CE_COUNT_MAX; i++) {
+		ath10k_err(ar, "ce-pipe [%i] rx-id: %i  ce-send-done: %d tx-id: %d bmi-send-done: %d bmi-recv: %d\n",
+			   i,
+			   pci->ce_states[i].last_rx_transfer_id,
+			   pci->ce_states[i].last_ce_send_done_transfer_id,
+			   pci->ce_states[i].last_tx_transfer_id,
+			   pci->ce_states[i].last_bmi_send_done_transfer_id,
+			   pci->ce_states[i].last_bmi_recv_transfer_id);
+	}
+	ath10k_err(ar, "last htt-tx-id: %d\n", ar->htt.htt_transfer_id);
+
 	queue_work(ar->workqueue, &ar->restart_work);
 }
 
@@ -1640,10 +1654,10 @@ static void ath10k_pci_bmi_send_done(struct ath10k_ce_pipe *ce_state)
 	struct bmi_xfer *xfer;
 	u32 ce_data;
 	unsigned int nbytes;
-	unsigned int transfer_id;
 
 	if (ath10k_ce_completed_send_next(ce_state, (void **)&xfer, &ce_data,
-					  &nbytes, &transfer_id))
+					  &nbytes,
+					  &ce_state->last_bmi_send_done_transfer_id))
 		return;
 
 	xfer->tx_done = true;
@@ -1655,11 +1669,12 @@ static void ath10k_pci_bmi_recv_data(struct ath10k_ce_pipe *ce_state)
 	struct bmi_xfer *xfer;
 	u32 ce_data;
 	unsigned int nbytes;
-	unsigned int transfer_id;
 	unsigned int flags;
 
 	if (ath10k_ce_completed_recv_next(ce_state, (void **)&xfer, &ce_data,
-					  &nbytes, &transfer_id, &flags))
+					  &nbytes,
+					  &ce_state->last_bmi_recv_transfer_id,
+					  &flags))
 		return;
 
 	if (WARN_ON_ONCE(!xfer))
-- 
1.7.11.7


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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 8/8] ath10k:  fix CE_DESC_FLAGS_META_DATA_LSB definition.
  2015-01-12 18:32 ` greearb
@ 2015-01-12 18:32   ` greearb
  -1 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Ben Greear

From: Ben Greear <greearb@candelatech.com>

The value was off by one.  The error probably has no negative
affect on any upstream firmware, but should be fixed anyway
in case it comes into use in the future.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/ce.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
index f4919e9..b92610b 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -39,7 +39,7 @@ struct ath10k_ce_pipe;
 #define CE_DESC_FLAGS_GATHER         (1 << 0)
 #define CE_DESC_FLAGS_BYTE_SWAP      (1 << 1)
 #define CE_DESC_FLAGS_META_DATA_MASK 0xFFFC
-#define CE_DESC_FLAGS_META_DATA_LSB  3
+#define CE_DESC_FLAGS_META_DATA_LSB  2
 
 struct ce_desc {
 	__le32 addr;
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 8/8] ath10k:  fix CE_DESC_FLAGS_META_DATA_LSB definition.
@ 2015-01-12 18:32   ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 18:32 UTC (permalink / raw)
  To: ath10k; +Cc: Ben Greear, linux-wireless

From: Ben Greear <greearb@candelatech.com>

The value was off by one.  The error probably has no negative
affect on any upstream firmware, but should be fixed anyway
in case it comes into use in the future.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/ce.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
index f4919e9..b92610b 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -39,7 +39,7 @@ struct ath10k_ce_pipe;
 #define CE_DESC_FLAGS_GATHER         (1 << 0)
 #define CE_DESC_FLAGS_BYTE_SWAP      (1 << 1)
 #define CE_DESC_FLAGS_META_DATA_MASK 0xFFFC
-#define CE_DESC_FLAGS_META_DATA_LSB  3
+#define CE_DESC_FLAGS_META_DATA_LSB  2
 
 struct ce_desc {
 	__le32 addr;
-- 
1.7.11.7


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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 4/8] ath10k:  make dbglog debug messages be 'warn' level.
  2015-01-12 18:32   ` greearb
@ 2015-02-04  7:44     ` Kalle Valo
  -1 siblings, 0 replies; 36+ messages in thread
From: Kalle Valo @ 2015-02-04  7:44 UTC (permalink / raw)
  To: greearb; +Cc: ath10k, linux-wireless

greearb@candelatech.com writes:

> From: Ben Greear <greearb@candelatech.com>
>
> This only happens on firmware crash, and it appears this
> logic is not always perfect, so make sure the information
> is printed to logs at higher level.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> ---
>  drivers/net/wireless/ath/ath10k/pci.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
> index 0f7e845..dee0d5a 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -1132,9 +1132,8 @@ static void ath10k_pci_dump_dbglog(struct ath10k *ar)
>  		return;
>  	}
>  
> -	ath10k_dbg(ar, ATH10K_DBG_PCI,
> -		   "debug log header, dbuf: 0x%x  dropped: %i\n",
> -		   le32_to_cpu(dbg_hdr.dbuf), le32_to_cpu(dbg_hdr.dropped));
> +	ath10k_warn(ar, "debug log header, dbuf: 0x%x  dropped: %i\n",
> +		    le32_to_cpu(dbg_hdr.dbuf), le32_to_cpu(dbg_hdr.dropped));
>  	dbufp = le32_to_cpu(dbg_hdr.dbuf);

I think a new debug level is more approriate, this is just spamming the
logs unnecessary.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 4/8] ath10k:  make dbglog debug messages be 'warn' level.
@ 2015-02-04  7:44     ` Kalle Valo
  0 siblings, 0 replies; 36+ messages in thread
From: Kalle Valo @ 2015-02-04  7:44 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, ath10k

greearb@candelatech.com writes:

> From: Ben Greear <greearb@candelatech.com>
>
> This only happens on firmware crash, and it appears this
> logic is not always perfect, so make sure the information
> is printed to logs at higher level.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> ---
>  drivers/net/wireless/ath/ath10k/pci.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
> index 0f7e845..dee0d5a 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -1132,9 +1132,8 @@ static void ath10k_pci_dump_dbglog(struct ath10k *ar)
>  		return;
>  	}
>  
> -	ath10k_dbg(ar, ATH10K_DBG_PCI,
> -		   "debug log header, dbuf: 0x%x  dropped: %i\n",
> -		   le32_to_cpu(dbg_hdr.dbuf), le32_to_cpu(dbg_hdr.dropped));
> +	ath10k_warn(ar, "debug log header, dbuf: 0x%x  dropped: %i\n",
> +		    le32_to_cpu(dbg_hdr.dbuf), le32_to_cpu(dbg_hdr.dropped));
>  	dbufp = le32_to_cpu(dbg_hdr.dbuf);

I think a new debug level is more approriate, this is just spamming the
logs unnecessary.

-- 
Kalle Valo

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 3/8] ath10k: fix spelling mistakes and add details to mac logging.
  2015-01-12 18:32   ` greearb
@ 2015-02-04  8:33     ` Kalle Valo
  -1 siblings, 0 replies; 36+ messages in thread
From: Kalle Valo @ 2015-02-04  8:33 UTC (permalink / raw)
  To: greearb; +Cc: ath10k, linux-wireless

greearb@candelatech.com writes:

> From: Ben Greear <greearb@candelatech.com>
>
> A bit of general cleanup to make debug messages more useful.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>

[...]

> -		ath10k_warn(ar, "failed to synchronise monitor vdev %i: %d\n",
> +		ath10k_warn(ar, "failed to synchronize monitor vdev %i: %d (stop)\n",

Hehe, spelling fixes? You know not everyone speak "American" ;)

Anyway, I changed the patch in pending branch to follow the style with
other similar warning messages:

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 40c666615993..f4ab3d0a5fa0 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -608,7 +608,7 @@ static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
 
        ret = ath10k_vdev_setup_sync(ar);
        if (ret) {
-               ath10k_warn(ar, "failed to synchronize setup for monitor vdev %i: %d (start)\n",
+               ath10k_warn(ar, "failed to synchronize setup for monitor vdev %i start: %d\n",
                            vdev_id, ret);
                return ret;
        }
@@ -655,7 +655,7 @@ static int ath10k_monitor_vdev_stop(struct ath10k *ar)
 
        ret = ath10k_vdev_setup_sync(ar);
        if (ret)
-               ath10k_warn(ar, "failed to synchronize monitor vdev %i: %d (stop)\n",
+               ath10k_warn(ar, "failed to synchronize monitor vdev %i stop: %d\n",
                            ar->monitor_vdev_id, ret);
 
        ath10k_dbg(ar, ATH10K_DBG_MAC, "mac monitor vdev %i stopped\n",
@@ -924,8 +924,9 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif, bool restart)
 
        ret = ath10k_vdev_setup_sync(ar);
        if (ret) {
-               ath10k_warn(ar, "failed to synchronize setup for vdev %i: %d (restart %d)\n",
-                           arg.vdev_id, ret, restart);
+               ath10k_warn(ar,
+                           "failed to synchronize setup for vdev %i restart %d: %d\n",
+                           arg.vdev_id, restart, ret);
                return ret;
        }
 
@@ -963,7 +964,7 @@ static int ath10k_vdev_stop(struct ath10k_vif *arvif)
 
        ret = ath10k_vdev_setup_sync(ar);
        if (ret) {
-               ath10k_warn(ar, "failed to synchronize setup for vdev %i: %d (stop)\n",
+               ath10k_warn(ar, "failed to synchronize setup for vdev %i stop: %d\n",
                            arvif->vdev_id, ret);
                return ret;
        }


-- 
Kalle Valo

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 3/8] ath10k: fix spelling mistakes and add details to mac logging.
@ 2015-02-04  8:33     ` Kalle Valo
  0 siblings, 0 replies; 36+ messages in thread
From: Kalle Valo @ 2015-02-04  8:33 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, ath10k

greearb@candelatech.com writes:

> From: Ben Greear <greearb@candelatech.com>
>
> A bit of general cleanup to make debug messages more useful.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>

[...]

> -		ath10k_warn(ar, "failed to synchronise monitor vdev %i: %d\n",
> +		ath10k_warn(ar, "failed to synchronize monitor vdev %i: %d (stop)\n",

Hehe, spelling fixes? You know not everyone speak "American" ;)

Anyway, I changed the patch in pending branch to follow the style with
other similar warning messages:

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 40c666615993..f4ab3d0a5fa0 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -608,7 +608,7 @@ static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
 
        ret = ath10k_vdev_setup_sync(ar);
        if (ret) {
-               ath10k_warn(ar, "failed to synchronize setup for monitor vdev %i: %d (start)\n",
+               ath10k_warn(ar, "failed to synchronize setup for monitor vdev %i start: %d\n",
                            vdev_id, ret);
                return ret;
        }
@@ -655,7 +655,7 @@ static int ath10k_monitor_vdev_stop(struct ath10k *ar)
 
        ret = ath10k_vdev_setup_sync(ar);
        if (ret)
-               ath10k_warn(ar, "failed to synchronize monitor vdev %i: %d (stop)\n",
+               ath10k_warn(ar, "failed to synchronize monitor vdev %i stop: %d\n",
                            ar->monitor_vdev_id, ret);
 
        ath10k_dbg(ar, ATH10K_DBG_MAC, "mac monitor vdev %i stopped\n",
@@ -924,8 +924,9 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif, bool restart)
 
        ret = ath10k_vdev_setup_sync(ar);
        if (ret) {
-               ath10k_warn(ar, "failed to synchronize setup for vdev %i: %d (restart %d)\n",
-                           arg.vdev_id, ret, restart);
+               ath10k_warn(ar,
+                           "failed to synchronize setup for vdev %i restart %d: %d\n",
+                           arg.vdev_id, restart, ret);
                return ret;
        }
 
@@ -963,7 +964,7 @@ static int ath10k_vdev_stop(struct ath10k_vif *arvif)
 
        ret = ath10k_vdev_setup_sync(ar);
        if (ret) {
-               ath10k_warn(ar, "failed to synchronize setup for vdev %i: %d (stop)\n",
+               ath10k_warn(ar, "failed to synchronize setup for vdev %i stop: %d\n",
                            arvif->vdev_id, ret);
                return ret;
        }


-- 
Kalle Valo

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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
  2015-01-12 18:32 ` greearb
@ 2015-02-04  8:37   ` Kalle Valo
  -1 siblings, 0 replies; 36+ messages in thread
From: Kalle Valo @ 2015-02-04  8:37 UTC (permalink / raw)
  To: greearb; +Cc: ath10k, linux-wireless

greearb@candelatech.com writes:

> From: Ben Greear <greearb@candelatech.com>
>
> In case firmware fails to start the scan, then complete
> the start condition and clean up so that driver does not
> block on timeout.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>

These patches are now in the pending branch.

86f50c71b224 ath10k: scan should handle scan-start-failed event properly
c6dde373a4bb ath10k: fix spelling mistakes and add details to mac logging
198c0184d94c ath10k: fix spelling in htt code comment
227822d52d26 ath10k: fix CE_DESC_FLAGS_META_DATA_LSB definition

I dropped the rest as I really would like to avoid maintaining yet
another firmware branch.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-02-04  8:37   ` Kalle Valo
  0 siblings, 0 replies; 36+ messages in thread
From: Kalle Valo @ 2015-02-04  8:37 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, ath10k

greearb@candelatech.com writes:

> From: Ben Greear <greearb@candelatech.com>
>
> In case firmware fails to start the scan, then complete
> the start condition and clean up so that driver does not
> block on timeout.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>

These patches are now in the pending branch.

86f50c71b224 ath10k: scan should handle scan-start-failed event properly
c6dde373a4bb ath10k: fix spelling mistakes and add details to mac logging
198c0184d94c ath10k: fix spelling in htt code comment
227822d52d26 ath10k: fix CE_DESC_FLAGS_META_DATA_LSB definition

I dropped the rest as I really would like to avoid maintaining yet
another firmware branch.

-- 
Kalle Valo

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
  2015-02-04  8:37   ` Kalle Valo
@ 2015-02-04 15:31     ` Ben Greear
  -1 siblings, 0 replies; 36+ messages in thread
From: Ben Greear @ 2015-02-04 15:31 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath10k, linux-wireless

On 02/04/2015 12:37 AM, Kalle Valo wrote:
> greearb@candelatech.com writes:
>
>> From: Ben Greear <greearb@candelatech.com>
>>
>> In case firmware fails to start the scan, then complete
>> the start condition and clean up so that driver does not
>> block on timeout.
>>
>> Signed-off-by: Ben Greear <greearb@candelatech.com>
>
> These patches are now in the pending branch.
>
> 86f50c71b224 ath10k: scan should handle scan-start-failed event properly
> c6dde373a4bb ath10k: fix spelling mistakes and add details to mac logging
> 198c0184d94c ath10k: fix spelling in htt code comment
> 227822d52d26 ath10k: fix CE_DESC_FLAGS_META_DATA_LSB definition
>
> I dropped the rest as I really would like to avoid maintaining yet
> another firmware branch.


Thanks for applying those.

I'll stop sending patches related to my firmware.

Thanks,
Ben

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


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-02-04 15:31     ` Ben Greear
  0 siblings, 0 replies; 36+ messages in thread
From: Ben Greear @ 2015-02-04 15:31 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, ath10k

On 02/04/2015 12:37 AM, Kalle Valo wrote:
> greearb@candelatech.com writes:
>
>> From: Ben Greear <greearb@candelatech.com>
>>
>> In case firmware fails to start the scan, then complete
>> the start condition and clean up so that driver does not
>> block on timeout.
>>
>> Signed-off-by: Ben Greear <greearb@candelatech.com>
>
> These patches are now in the pending branch.
>
> 86f50c71b224 ath10k: scan should handle scan-start-failed event properly
> c6dde373a4bb ath10k: fix spelling mistakes and add details to mac logging
> 198c0184d94c ath10k: fix spelling in htt code comment
> 227822d52d26 ath10k: fix CE_DESC_FLAGS_META_DATA_LSB definition
>
> I dropped the rest as I really would like to avoid maintaining yet
> another firmware branch.


Thanks for applying those.

I'll stop sending patches related to my firmware.

Thanks,
Ben

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


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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
  2015-02-04  8:37   ` Kalle Valo
@ 2015-02-15 15:03     ` Kalle Valo
  -1 siblings, 0 replies; 36+ messages in thread
From: Kalle Valo @ 2015-02-15 15:03 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, ath10k

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

> These patches are now in the pending branch.
>
> 86f50c71b224 ath10k: scan should handle scan-start-failed event properly
> c6dde373a4bb ath10k: fix spelling mistakes and add details to mac logging
> 198c0184d94c ath10k: fix spelling in htt code comment
> 227822d52d26 ath10k: fix CE_DESC_FLAGS_META_DATA_LSB definition

Thanks, applied to ath.git.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-02-15 15:03     ` Kalle Valo
  0 siblings, 0 replies; 36+ messages in thread
From: Kalle Valo @ 2015-02-15 15:03 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, ath10k

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

> These patches are now in the pending branch.
>
> 86f50c71b224 ath10k: scan should handle scan-start-failed event properly
> c6dde373a4bb ath10k: fix spelling mistakes and add details to mac logging
> 198c0184d94c ath10k: fix spelling in htt code comment
> 227822d52d26 ath10k: fix CE_DESC_FLAGS_META_DATA_LSB definition

Thanks, applied to ath.git.

-- 
Kalle Valo

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
  2015-01-13 13:42     ` Kalle Valo
@ 2015-01-13 16:15       ` Ben Greear
  -1 siblings, 0 replies; 36+ messages in thread
From: Ben Greear @ 2015-01-13 16:15 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, ath10k



On 01/13/2015 05:42 AM, Kalle Valo wrote:
> Ben Greear <greearb@candelatech.com> writes:
>
>> Sorry about the resends...had mail-server issue, should be resolved now.
>
> So which one should I look at? Or are the patches the same in both sets?

All the same.

Ben

>

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-01-13 16:15       ` Ben Greear
  0 siblings, 0 replies; 36+ messages in thread
From: Ben Greear @ 2015-01-13 16:15 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, ath10k



On 01/13/2015 05:42 AM, Kalle Valo wrote:
> Ben Greear <greearb@candelatech.com> writes:
>
>> Sorry about the resends...had mail-server issue, should be resolved now.
>
> So which one should I look at? Or are the patches the same in both sets?

All the same.

Ben

>

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

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
  2015-01-12 19:53   ` Ben Greear
@ 2015-01-13 13:42     ` Kalle Valo
  -1 siblings, 0 replies; 36+ messages in thread
From: Kalle Valo @ 2015-01-13 13:42 UTC (permalink / raw)
  To: Ben Greear; +Cc: linux-wireless, ath10k

Ben Greear <greearb@candelatech.com> writes:

> Sorry about the resends...had mail-server issue, should be resolved now.

So which one should I look at? Or are the patches the same in both sets?

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-01-13 13:42     ` Kalle Valo
  0 siblings, 0 replies; 36+ messages in thread
From: Kalle Valo @ 2015-01-13 13:42 UTC (permalink / raw)
  To: Ben Greear; +Cc: linux-wireless, ath10k

Ben Greear <greearb@candelatech.com> writes:

> Sorry about the resends...had mail-server issue, should be resolved now.

So which one should I look at? Or are the patches the same in both sets?

-- 
Kalle Valo

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
  2015-01-12 19:29 ` greearb
@ 2015-01-12 19:53   ` Ben Greear
  -1 siblings, 0 replies; 36+ messages in thread
From: Ben Greear @ 2015-01-12 19:53 UTC (permalink / raw)
  To: greearb; +Cc: ath10k, linux-wireless

Sorry about the resends...had mail-server issue, should be resolved now.

Thanks,
Ben

On 01/12/2015 11:29 AM, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> In case firmware fails to start the scan, then complete
> the start condition and clean up so that driver does not
> block on timeout.


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


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-01-12 19:53   ` Ben Greear
  0 siblings, 0 replies; 36+ messages in thread
From: Ben Greear @ 2015-01-12 19:53 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, ath10k

Sorry about the resends...had mail-server issue, should be resolved now.

Thanks,
Ben

On 01/12/2015 11:29 AM, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> In case firmware fails to start the scan, then complete
> the start condition and clean up so that driver does not
> block on timeout.


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


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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-01-12 19:41 ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 19:41 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Ben Greear

From: Ben Greear <greearb@candelatech.com>

In case firmware fails to start the scan, then complete
the start condition and clean up so that driver does not
block on timeout.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 11 +++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 249107d..924879f 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2375,6 +2375,17 @@ static int ath10k_start_scan(struct ath10k *ar,
 		return -ETIMEDOUT;
 	}
 
+	/* If we failed to start the scan, return error code at
+	 * this point.  This is probably due to some issue in the
+	 * firmware, but no need to wedge the driver due to that...
+	 */
+	spin_lock_bh(&ar->data_lock);
+	if (ar->scan.state == ATH10K_SCAN_IDLE) {
+		spin_unlock_bh(&ar->data_lock);
+		return -EINVAL;
+	}
+	spin_unlock_bh(&ar->data_lock);
+
 	/* Add a 200ms margin to account for event/command processing */
 	ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout,
 				     msecs_to_jiffies(arg->max_scan_time+200));
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 6e4ece0..203bcb9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -916,6 +916,25 @@ static void ath10k_wmi_event_scan_started(struct ath10k *ar)
 	}
 }
 
+static void ath10k_wmi_event_scan_start_failed(struct ath10k *ar)
+{
+	lockdep_assert_held(&ar->data_lock);
+
+	switch (ar->scan.state) {
+	case ATH10K_SCAN_IDLE:
+	case ATH10K_SCAN_RUNNING:
+	case ATH10K_SCAN_ABORTING:
+		ath10k_warn(ar, "received scan start failed event in an invalid scan state: %s (%d)\n",
+			    ath10k_scan_state_str(ar->scan.state),
+			    ar->scan.state);
+		break;
+	case ATH10K_SCAN_STARTING:
+		complete(&ar->scan.started);
+		__ath10k_scan_finish(ar);
+		break;
+	}
+}
+
 static void ath10k_wmi_event_scan_completed(struct ath10k *ar)
 {
 	lockdep_assert_held(&ar->data_lock);
@@ -1057,6 +1076,7 @@ static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
 		break;
 	case WMI_SCAN_EVENT_START_FAILED:
 		ath10k_warn(ar, "received scan start failure event\n");
+		ath10k_wmi_event_scan_start_failed(ar);
 		break;
 	case WMI_SCAN_EVENT_DEQUEUED:
 	case WMI_SCAN_EVENT_PREEMPTED:
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-01-12 19:41 ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 19:41 UTC (permalink / raw)
  To: ath10k; +Cc: Ben Greear, linux-wireless

From: Ben Greear <greearb@candelatech.com>

In case firmware fails to start the scan, then complete
the start condition and clean up so that driver does not
block on timeout.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 11 +++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 249107d..924879f 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2375,6 +2375,17 @@ static int ath10k_start_scan(struct ath10k *ar,
 		return -ETIMEDOUT;
 	}
 
+	/* If we failed to start the scan, return error code at
+	 * this point.  This is probably due to some issue in the
+	 * firmware, but no need to wedge the driver due to that...
+	 */
+	spin_lock_bh(&ar->data_lock);
+	if (ar->scan.state == ATH10K_SCAN_IDLE) {
+		spin_unlock_bh(&ar->data_lock);
+		return -EINVAL;
+	}
+	spin_unlock_bh(&ar->data_lock);
+
 	/* Add a 200ms margin to account for event/command processing */
 	ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout,
 				     msecs_to_jiffies(arg->max_scan_time+200));
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 6e4ece0..203bcb9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -916,6 +916,25 @@ static void ath10k_wmi_event_scan_started(struct ath10k *ar)
 	}
 }
 
+static void ath10k_wmi_event_scan_start_failed(struct ath10k *ar)
+{
+	lockdep_assert_held(&ar->data_lock);
+
+	switch (ar->scan.state) {
+	case ATH10K_SCAN_IDLE:
+	case ATH10K_SCAN_RUNNING:
+	case ATH10K_SCAN_ABORTING:
+		ath10k_warn(ar, "received scan start failed event in an invalid scan state: %s (%d)\n",
+			    ath10k_scan_state_str(ar->scan.state),
+			    ar->scan.state);
+		break;
+	case ATH10K_SCAN_STARTING:
+		complete(&ar->scan.started);
+		__ath10k_scan_finish(ar);
+		break;
+	}
+}
+
 static void ath10k_wmi_event_scan_completed(struct ath10k *ar)
 {
 	lockdep_assert_held(&ar->data_lock);
@@ -1057,6 +1076,7 @@ static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
 		break;
 	case WMI_SCAN_EVENT_START_FAILED:
 		ath10k_warn(ar, "received scan start failure event\n");
+		ath10k_wmi_event_scan_start_failed(ar);
 		break;
 	case WMI_SCAN_EVENT_DEQUEUED:
 	case WMI_SCAN_EVENT_PREEMPTED:
-- 
1.7.11.7


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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-01-12 19:29 ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 19:29 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Ben Greear

From: Ben Greear <greearb@candelatech.com>

In case firmware fails to start the scan, then complete
the start condition and clean up so that driver does not
block on timeout.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 11 +++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 249107d..924879f 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2375,6 +2375,17 @@ static int ath10k_start_scan(struct ath10k *ar,
 		return -ETIMEDOUT;
 	}
 
+	/* If we failed to start the scan, return error code at
+	 * this point.  This is probably due to some issue in the
+	 * firmware, but no need to wedge the driver due to that...
+	 */
+	spin_lock_bh(&ar->data_lock);
+	if (ar->scan.state == ATH10K_SCAN_IDLE) {
+		spin_unlock_bh(&ar->data_lock);
+		return -EINVAL;
+	}
+	spin_unlock_bh(&ar->data_lock);
+
 	/* Add a 200ms margin to account for event/command processing */
 	ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout,
 				     msecs_to_jiffies(arg->max_scan_time+200));
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 6e4ece0..203bcb9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -916,6 +916,25 @@ static void ath10k_wmi_event_scan_started(struct ath10k *ar)
 	}
 }
 
+static void ath10k_wmi_event_scan_start_failed(struct ath10k *ar)
+{
+	lockdep_assert_held(&ar->data_lock);
+
+	switch (ar->scan.state) {
+	case ATH10K_SCAN_IDLE:
+	case ATH10K_SCAN_RUNNING:
+	case ATH10K_SCAN_ABORTING:
+		ath10k_warn(ar, "received scan start failed event in an invalid scan state: %s (%d)\n",
+			    ath10k_scan_state_str(ar->scan.state),
+			    ar->scan.state);
+		break;
+	case ATH10K_SCAN_STARTING:
+		complete(&ar->scan.started);
+		__ath10k_scan_finish(ar);
+		break;
+	}
+}
+
 static void ath10k_wmi_event_scan_completed(struct ath10k *ar)
 {
 	lockdep_assert_held(&ar->data_lock);
@@ -1057,6 +1076,7 @@ static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
 		break;
 	case WMI_SCAN_EVENT_START_FAILED:
 		ath10k_warn(ar, "received scan start failure event\n");
+		ath10k_wmi_event_scan_start_failed(ar);
 		break;
 	case WMI_SCAN_EVENT_DEQUEUED:
 	case WMI_SCAN_EVENT_PREEMPTED:
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly.
@ 2015-01-12 19:29 ` greearb
  0 siblings, 0 replies; 36+ messages in thread
From: greearb @ 2015-01-12 19:29 UTC (permalink / raw)
  To: ath10k; +Cc: Ben Greear, linux-wireless

From: Ben Greear <greearb@candelatech.com>

In case firmware fails to start the scan, then complete
the start condition and clean up so that driver does not
block on timeout.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/ath/ath10k/mac.c | 11 +++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 249107d..924879f 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2375,6 +2375,17 @@ static int ath10k_start_scan(struct ath10k *ar,
 		return -ETIMEDOUT;
 	}
 
+	/* If we failed to start the scan, return error code at
+	 * this point.  This is probably due to some issue in the
+	 * firmware, but no need to wedge the driver due to that...
+	 */
+	spin_lock_bh(&ar->data_lock);
+	if (ar->scan.state == ATH10K_SCAN_IDLE) {
+		spin_unlock_bh(&ar->data_lock);
+		return -EINVAL;
+	}
+	spin_unlock_bh(&ar->data_lock);
+
 	/* Add a 200ms margin to account for event/command processing */
 	ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout,
 				     msecs_to_jiffies(arg->max_scan_time+200));
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 6e4ece0..203bcb9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -916,6 +916,25 @@ static void ath10k_wmi_event_scan_started(struct ath10k *ar)
 	}
 }
 
+static void ath10k_wmi_event_scan_start_failed(struct ath10k *ar)
+{
+	lockdep_assert_held(&ar->data_lock);
+
+	switch (ar->scan.state) {
+	case ATH10K_SCAN_IDLE:
+	case ATH10K_SCAN_RUNNING:
+	case ATH10K_SCAN_ABORTING:
+		ath10k_warn(ar, "received scan start failed event in an invalid scan state: %s (%d)\n",
+			    ath10k_scan_state_str(ar->scan.state),
+			    ar->scan.state);
+		break;
+	case ATH10K_SCAN_STARTING:
+		complete(&ar->scan.started);
+		__ath10k_scan_finish(ar);
+		break;
+	}
+}
+
 static void ath10k_wmi_event_scan_completed(struct ath10k *ar)
 {
 	lockdep_assert_held(&ar->data_lock);
@@ -1057,6 +1076,7 @@ static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
 		break;
 	case WMI_SCAN_EVENT_START_FAILED:
 		ath10k_warn(ar, "received scan start failure event\n");
+		ath10k_wmi_event_scan_start_failed(ar);
 		break;
 	case WMI_SCAN_EVENT_DEQUEUED:
 	case WMI_SCAN_EVENT_PREEMPTED:
-- 
1.7.11.7


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

^ permalink raw reply related	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2015-02-15 15:03 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-12 18:32 [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly greearb
2015-01-12 18:32 ` greearb
2015-01-12 18:32 ` [PATCH 2/8] ath10k: add wmi-id to htc credits debugging greearb
2015-01-12 18:32   ` greearb
2015-01-12 18:32 ` [PATCH 3/8] ath10k: fix spelling mistakes and add details to mac logging greearb
2015-01-12 18:32   ` greearb
2015-02-04  8:33   ` Kalle Valo
2015-02-04  8:33     ` Kalle Valo
2015-01-12 18:32 ` [PATCH 4/8] ath10k: make dbglog debug messages be 'warn' level greearb
2015-01-12 18:32   ` greearb
2015-02-04  7:44   ` Kalle Valo
2015-02-04  7:44     ` Kalle Valo
2015-01-12 18:32 ` [RFC 5/8] ath10k: add firmware wmi keep-alive message greearb
2015-01-12 18:32   ` greearb
2015-01-12 18:32 ` [PATCH 6/8] ath10k: fix spelling in htt code comment greearb
2015-01-12 18:32   ` greearb
2015-01-12 18:32 ` [PATCH 7/8] ath10k: start using htt/pci/ce transfer_id properly greearb
2015-01-12 18:32   ` greearb
2015-01-12 18:32 ` [PATCH 8/8] ath10k: fix CE_DESC_FLAGS_META_DATA_LSB definition greearb
2015-01-12 18:32   ` greearb
2015-02-04  8:37 ` [PATCH 1/8] ath10k: scan should handle scan-start-failed event properly Kalle Valo
2015-02-04  8:37   ` Kalle Valo
2015-02-04 15:31   ` Ben Greear
2015-02-04 15:31     ` Ben Greear
2015-02-15 15:03   ` Kalle Valo
2015-02-15 15:03     ` Kalle Valo
2015-01-12 19:29 greearb
2015-01-12 19:29 ` greearb
2015-01-12 19:53 ` Ben Greear
2015-01-12 19:53   ` Ben Greear
2015-01-13 13:42   ` Kalle Valo
2015-01-13 13:42     ` Kalle Valo
2015-01-13 16:15     ` Ben Greear
2015-01-13 16:15       ` Ben Greear
2015-01-12 19:41 greearb
2015-01-12 19:41 ` greearb

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.