Skip to contentSkip to conversation

ath10k: scan should handle scan-start-failed event properly.

PATCH Applied [email protected] 2 participants 4 messages Jan 12, 2015 – Jan 13, 2015 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 ath10k: scan should handle scan-start-failed event properly.

From: Ben Greear <[email protected]>

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

---
 drivers/net/wireless/ath/ath10k/mac.c | 11 +++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+)
drivers/net/wireless/ath/ath10k/mac.c +11 -0
index 249107d..924879f 100644
@@ -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));
drivers/net/wireless/ath/ath10k/wmi.c +20 -0
index 6e4ece0..203bcb9 100644
@@ -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:
Signature · 1 line
1.7.11.7
author
#1 lore raw

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

Thanks,
Ben

Quoted 5 lines · On 01/12/2015 11:29 AM, [email protected] wrote:

From: Ben Greear <[email protected]>

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

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#2 lore raw
Quoted 1 line · Ben Greear

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?

Signature · 1 line
Kalle Valo
author
#3 lore raw
Quoted 5 lines · Kalle Valo
Quoted 1 line · Ben Greear

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

Quoted 1 line
Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com