Skip to content

Commit

Permalink
ath10k: add spectral scan feature
Browse files Browse the repository at this point in the history
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: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
  • Loading branch information
Simon Wunderlich authored and Kalle Valo committed Aug 4, 2014
1 parent 95752b7 commit 855aed1
Show file tree
Hide file tree
Showing 10 changed files with 908 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath10k/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ config ATH10K_DEBUG
config ATH10K_DEBUGFS
bool "Atheros ath10k debugfs support"
depends on ATH10K
select RELAY
---help---
Enabled debugfs support

Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath10k/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions drivers/net/wireless/ath/ath10k/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions drivers/net/wireless/ath/ath10k/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -237,6 +238,7 @@ struct ath10k_vif {

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

Expand Down Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions drivers/net/wireless/ath/ath10k/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down
Loading

0 comments on commit 855aed1

Please sign in to comment.