ath9k: add debugfs based DFS radar simulation
authorZefir Kurtisi <zefir.kurtisi@neratec.com>
Wed, 3 Apr 2013 16:31:30 +0000 (18:31 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 8 Apr 2013 19:28:38 +0000 (15:28 -0400)
This helps testing DFS without radar generating
equipment and is required for certification.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/dfs_debug.c

index 55d28072adeb3a1f5ca54a7e108dd5c8ae02d22f..b7611b7bbe437e289bd5f452c5cdf6d125a6c702 100644 (file)
@@ -105,6 +105,24 @@ static ssize_t write_file_dfs(struct file *file, const char __user *user_buf,
        return count;
 }
 
+static ssize_t write_file_simulate_radar(struct file *file,
+                                        const char __user *user_buf,
+                                        size_t count, loff_t *ppos)
+{
+       struct ath_softc *sc = file->private_data;
+
+       ieee80211_radar_detected(sc->hw);
+
+       return count;
+}
+
+static const struct file_operations fops_simulate_radar = {
+       .write = write_file_simulate_radar,
+       .open = simple_open,
+       .owner = THIS_MODULE,
+       .llseek = default_llseek,
+};
+
 static const struct file_operations fops_dfs_stats = {
        .read = read_file_dfs,
        .write = write_file_dfs,
@@ -117,4 +135,6 @@ void ath9k_dfs_init_debug(struct ath_softc *sc)
 {
        debugfs_create_file("dfs_stats", S_IRUSR,
                            sc->debug.debugfs_phy, sc, &fops_dfs_stats);
+       debugfs_create_file("dfs_simulate_radar", S_IWUSR,
+                           sc->debug.debugfs_phy, sc, &fops_simulate_radar);
 }