Skip to contentSkip to conversation

ath10k: fixes

PATCH Superseded Michal Kazior 3 participants 8 messages Jun 6, 2013 – Jun 7, 2013 Qualcomm Atheros ATH10K wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ath10k: fixes

This is part 1 of 4 of a bigger patchset.
Split for easier review.

Contains functional fixes.

Michal Kazior (4):
ath10k: fix teardown ordering
ath10k: fix possible deadlock
ath10k: setup rts/frag thresholds upon vdev creation
ath10k: do not setup rts/frag thresholds for suspended interfaces

 drivers/net/wireless/ath/ath10k/mac.c |   30 +++++++++++++++++++++++++-----
 drivers/net/wireless/ath/ath10k/pci.c |    2 +-
 2 files changed, 26 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/4 ath10k: fix teardown ordering

This should fix memory corruption if HIF is tried
to be restarted.

---
 drivers/net/wireless/ath/ath10k/pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/pci.c +1 -1
index 8e4e832..1bd381f 100644
@@ -1263,7 +1263,6 @@ static void ath10k_pci_hif_stop(struct ath10k *ar)
 	ath10k_pci_process_ce(ar);
 	ath10k_pci_cleanup_ce(ar);
 	ath10k_pci_buffer_cleanup(ar);
-	ath10k_pci_ce_deinit(ar);
 }
 
 static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k *ar,
@@ -2332,6 +2331,7 @@ static void ath10k_pci_remove(struct pci_dev *pdev)
 	tasklet_kill(&ar_pci->msi_fw_err);
 
 	ath10k_core_unregister(ar);
+	ath10k_pci_ce_deinit(ar);
 	ath10k_pci_stop_intr(ar);
 
 	pci_set_drvdata(pdev, NULL);
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 ath10k: fix possible deadlock

In reply to Michal Kazior

It was possible to have a deadlock due to inverted locking of local->iflist_mtx and ath10k->conf_mutex.

---
 drivers/net/wireless/ath/ath10k/mac.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +6 -4
index 1285554..9943ee9 100644
@@ -2578,8 +2578,9 @@ static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 	ar_iter.ar = ar;
 
 	mutex_lock(&ar->conf_mutex);
-	ieee80211_iterate_active_interfaces(hw, IEEE80211_IFACE_ITER_RESUME_ALL,
-					    ath10k_set_rts_iter, &ar_iter);
+	ieee80211_iterate_active_interfaces_atomic(
+		hw, IEEE80211_IFACE_ITER_RESUME_ALL,
+		ath10k_set_rts_iter, &ar_iter);
 	mutex_unlock(&ar->conf_mutex);
 
 	return ar_iter.ret;
@@ -2619,8 +2620,9 @@ static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
 	ar_iter.ar = ar;
 
 	mutex_lock(&ar->conf_mutex);
-	ieee80211_iterate_active_interfaces(hw, IEEE80211_IFACE_ITER_RESUME_ALL,
-					    ath10k_set_frag_iter, &ar_iter);
+	ieee80211_iterate_active_interfaces_atomic(
+		hw, IEEE80211_IFACE_ITER_RESUME_ALL,
+		ath10k_set_frag_iter, &ar_iter);
 	mutex_unlock(&ar->conf_mutex);
 
 	return ar_iter.ret;
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/4 ath10k: setup rts/frag thresholds upon vdev creation

In reply to Michal Kazior

mac80211 configures rts/frag thresholds per-hw not per-vif. ath10k FW expects those values to be set per-vdev (i.e. per-vif).

ath10k should now respect rts/frag thresholds set
before a given interface was brought up.

---
 drivers/net/wireless/ath/ath10k/mac.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/mac.c +19 -1
index 9943ee9..ff0bb38 100644
@@ -1753,7 +1753,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;
+	u32 value, rts, frag;
 	int bit;
 
 	mutex_lock(&ar->conf_mutex);
@@ -1856,6 +1856,24 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 			ath10k_warn("Failed to set PSPOLL count: %d\n", ret);
 	}
 
+	rts = min_t(u32, ar->hw->wiphy->rts_threshold, ATH10K_RTS_MAX);
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
+					 WMI_VDEV_PARAM_RTS_THRESHOLD,
+					 rts);
+	if (ret)
+		ath10k_warn("failed to set rts threshold for vdev %d (%d)\n",
+			    arvif->vdev_id, ret);
+
+	frag = clamp_t(u32, ar->hw->wiphy->frag_threshold,
+		       ATH10K_FRAGMT_THRESHOLD_MIN,
+		       ATH10K_FRAGMT_THRESHOLD_MAX);
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
+					WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
+					frag);
+	if (ret)
+		ath10k_warn("failed to set frag threshold for vdev %d (%d)\n",
+			    arvif->vdev_id, ret);
+
 	if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
 		ar->monitor_present = true;
 
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 3/4 ath10k: setup rts/frag thresholds upon vdev creation

drivers/net/wireless/ath/ath10k/mac.c static int ath10k_add_interface(struct ieee80211_hw *hw, · line 1872

Quoted 6 lines · Michal Kazior
drivers/net/wireless/ath/ath10k/mac.c +6 -0
+	frag = clamp_t(u32, ar->hw->wiphy->frag_threshold,
+		       ATH10K_FRAGMT_THRESHOLD_MIN,
+		       ATH10K_FRAGMT_THRESHOLD_MAX);
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
+					WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
+					frag);

Looks like the FW doesn't handle WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD at all.

Sujith

#5 lore raw

PATCH 4/4 ath10k: do not setup rts/frag thresholds for suspended interfaces

In reply to Michal Kazior

mac80211 calls for rts/frag threshold hooks before any interface is brought back up again when resuming.

We would set vdev parameters before given vdev is
created lading to a FW crash.

rts/frag thresholds will be re-set accordingly in
add_interface() hook anyway.

---
 drivers/net/wireless/ath/ath10k/mac.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +2 -2
index ff0bb38..cdee800 100644
@@ -2597,7 +2597,7 @@ static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 
 	mutex_lock(&ar->conf_mutex);
 	ieee80211_iterate_active_interfaces_atomic(
-		hw, IEEE80211_IFACE_ITER_RESUME_ALL,
+		hw, IEEE80211_IFACE_ITER_NORMAL,
 		ath10k_set_rts_iter, &ar_iter);
 	mutex_unlock(&ar->conf_mutex);
 
@@ -2639,7 +2639,7 @@ static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
 
 	mutex_lock(&ar->conf_mutex);
 	ieee80211_iterate_active_interfaces_atomic(
-		hw, IEEE80211_IFACE_ITER_RESUME_ALL,
+		hw, IEEE80211_IFACE_ITER_NORMAL,
 		ath10k_set_frag_iter, &ar_iter);
 	mutex_unlock(&ar->conf_mutex);
 
Signature · 1 line
1.7.9.5
#6 lore raw

cover ath10k: fixes

In reply to Michal Kazior
Quoted 11 lines · Michal Kazior

This is part 1 of 4 of a bigger patchset.
Split for easier review.

Contains functional fixes.

Michal Kazior (4):
ath10k: fix teardown ordering
ath10k: fix possible deadlock
ath10k: setup rts/frag thresholds upon vdev creation
ath10k: do not setup rts/frag thresholds for suspended interfaces

Quoted 3 lines
 drivers/net/wireless/ath/ath10k/mac.c |   30 +++++++++++++++++++++++++-----
 drivers/net/wireless/ath/ath10k/pci.c |    2 +-
 2 files changed, 26 insertions(+), 6 deletions(-)

Other than the observation about an incomplete FW feature, this looks good to me.

Sujith

Applied
#7 lore raw

cover ath10k: fixes

Quoted 12 lines · Sujith Manoharan
Quoted 11 lines · Michal Kazior

This is part 1 of 4 of a bigger patchset.
Split for easier review.

Contains functional fixes.

Michal Kazior (4):
ath10k: fix teardown ordering
ath10k: fix possible deadlock
ath10k: setup rts/frag thresholds upon vdev creation
ath10k: do not setup rts/frag thresholds for suspended interfaces

Quoted 3 lines
Quoted 3 lines
 drivers/net/wireless/ath/ath10k/mac.c |   30 +++++++++++++++++++++++++-----
 drivers/net/wireless/ath/ath10k/pci.c |    2 +-
 2 files changed, 26 insertions(+), 6 deletions(-)

Thanks, applied.

Quoted 2 lines

Other than the observation about an incomplete FW feature, this looks good to me.

I applied that patch anyway as I'm hoping it will be implemented in fw eventually. Thanks for the review.

Signature · 1 line
Kalle Valo