Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 855aed12 authored by Simon Wunderlich's avatar Simon Wunderlich Committed by Kalle Valo
Browse files

ath10k: add spectral scan feature



Adds the spectral scan feature for ath10k. The spectral scan is triggered by
configuring a mode through a debugfs control file. Samples can be gathered via
another relay debugfs file.

Essentially, to try it out:

ip link set dev wlan0 up
echo background > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl
echo trigger > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl
iw dev wlan0 scan
echo disable > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl
cat /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan0 > samples

This feature is still experimental. Based on the original RFC patch of
Sven Eckelmann.

Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: default avatarMathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 95752b75
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ config ATH10K_DEBUG
config ATH10K_DEBUGFS
	bool "Atheros ath10k debugfs support"
	depends on ATH10K
	select RELAY
	---help---
	  Enabled debugfs support

+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ ath10k_core-y += mac.o \
		 wmi.o \
		 bmi.o

ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o
ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o

obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o
+10 −0
Original line number Diff line number Diff line
@@ -1000,9 +1000,17 @@ static void ath10k_core_register_work(struct work_struct *work)
		goto err_unregister_mac;
	}

	status = ath10k_spectral_create(ar);
	if (status) {
		ath10k_err("failed to initialize spectral\n");
		goto err_debug_destroy;
	}

	set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags);
	return;

err_debug_destroy:
	ath10k_debug_destroy(ar);
err_unregister_mac:
	ath10k_mac_unregister(ar);
err_release_fw:
@@ -1046,6 +1054,8 @@ void ath10k_core_unregister(struct ath10k *ar)

	ath10k_core_free_firmware_files(ar);

	ath10k_spectral_destroy(ar);

	ath10k_debug_destroy(ar);
}
EXPORT_SYMBOL(ath10k_core_unregister);
+11 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include "../ath.h"
#include "../regd.h"
#include "../dfs_pattern_detector.h"
#include "spectral.h"

#define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB)
#define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
@@ -237,6 +238,7 @@ struct ath10k_vif {

	bool is_started;
	bool is_up;
	bool spectral_enabled;
	u32 aid;
	u8 bssid[ETH_ALEN];

@@ -499,6 +501,15 @@ struct ath10k {
#ifdef CONFIG_ATH10K_DEBUGFS
	struct ath10k_debug debug;
#endif

	struct {
		/* relay(fs) channel for spectral scan */
		struct rchan *rfs_chan_spec_scan;

		/* spectral_mode and spec_config are protected by conf_mutex */
		enum ath10k_spectral_mode mode;
		struct ath10k_spec_scan config;
	} spectral;
};

struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
+8 −0
Original line number Diff line number Diff line
@@ -2499,6 +2499,8 @@ static int ath10k_start(struct ieee80211_hw *hw)
	ar->num_started_vdevs = 0;
	ath10k_regd_update(ar);

	ath10k_spectral_start(ar);

	mutex_unlock(&ar->conf_mutex);
	return 0;

@@ -2909,8 +2911,14 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
		dev_kfree_skb_any(arvif->beacon);
		arvif->beacon = NULL;
	}

	spin_unlock_bh(&ar->data_lock);

	ret = ath10k_spectral_vif_stop(arvif);
	if (ret)
		ath10k_warn("failed to stop spectral for vdev %i: %d\n",
			    arvif->vdev_id, ret);

	ar->free_vdev_map |= 1 << (arvif->vdev_id);
	list_del(&arvif->list);

Loading