]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ath9k: dfs move ath_dfs_pool_stats
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>
Mon, 14 Oct 2013 09:06:04 +0000 (11:06 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 18 Oct 2013 18:03:54 +0000 (14:03 -0400)
Move ath_dfs_pool_stats to dfs_pattern_detector
code to be not specyfic only for ath9k.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/dfs_debug.c
drivers/net/wireless/ath/ath9k/dfs_debug.h
drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
drivers/net/wireless/ath/ath9k/dfs_pattern_detector.h
drivers/net/wireless/ath/ath9k/dfs_pri_detector.c
drivers/net/wireless/ath/ath9k/dfs_pri_detector.h

index 821599135d8a0f856457ca5108b5c6e162d01247..990c376307259b6bd9b65428016d923f27701657 100644 (file)
 
 #include "ath9k.h"
 #include "dfs_debug.h"
+#include "dfs_pattern_detector.h"
 
-
-struct ath_dfs_pool_stats global_dfs_pool_stats = { 0 };
+static struct ath_dfs_pool_stats dfs_pool_stats = { 0 };
 
 #define ATH9K_DFS_STAT(s, p) \
        len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
                         sc->debug.stats.dfs_stats.p);
 #define ATH9K_DFS_POOL_STAT(s, p) \
        len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
-                        global_dfs_pool_stats.p);
+                        dfs_pool_stats.p);
 
 static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
                             size_t count, loff_t *ppos)
@@ -44,6 +44,9 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
        if (buf == NULL)
                return -ENOMEM;
 
+       if (sc->dfs_detector)
+               dfs_pool_stats = sc->dfs_detector->get_stats(sc->dfs_detector);
+
        len += scnprintf(buf + len, size - len, "DFS support for "
                         "macVersion = 0x%x, macRev = 0x%x: %s\n",
                         hw_ver->macVersion, hw_ver->macRev,
index e36810a4b585c51515e6fc3336410e1b58e3a9b0..0a7ddf4c88c93eb55589dedff95394e2157c3510 100644 (file)
@@ -51,25 +51,11 @@ struct ath_dfs_stats {
        u32 radar_detected;
 };
 
-/**
- * struct ath_dfs_pool_stats - DFS Statistics for global pools
- */
-struct ath_dfs_pool_stats {
-       u32 pool_reference;
-       u32 pulse_allocated;
-       u32 pulse_alloc_error;
-       u32 pulse_used;
-       u32 pseq_allocated;
-       u32 pseq_alloc_error;
-       u32 pseq_used;
-};
 #if defined(CONFIG_ATH9K_DFS_DEBUGFS)
 
 #define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++)
 void ath9k_dfs_init_debug(struct ath_softc *sc);
 
-#define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++)
-#define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--)
 extern struct ath_dfs_pool_stats global_dfs_pool_stats;
 
 #else
@@ -77,8 +63,6 @@ extern struct ath_dfs_pool_stats global_dfs_pool_stats;
 #define DFS_STAT_INC(sc, c) do { } while (0)
 static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { }
 
-#define DFS_POOL_STAT_INC(c) do { } while (0)
-#define DFS_POOL_STAT_DEC(c) do { } while (0)
 #endif /* CONFIG_ATH9K_DFS_DEBUGFS */
 
 #endif /* ATH9K_DFS_DEBUG_H */
index c839a78812d4b94d6936ee1fb4a4eec2642cada2..b0dcd1b72f3145478012831cab7b9a539767d669 100644 (file)
@@ -253,6 +253,12 @@ dpd_add_pulse(struct dfs_pattern_detector *dpd, struct pulse_event *event)
        return false;
 }
 
+static struct ath_dfs_pool_stats
+dpd_get_stats(struct dfs_pattern_detector *dpd)
+{
+       return global_dfs_pool_stats;
+}
+
 static bool dpd_set_domain(struct dfs_pattern_detector *dpd,
                           enum nl80211_dfs_regions region)
 {
@@ -283,6 +289,7 @@ static struct dfs_pattern_detector default_dpd = {
        .exit           = dpd_exit,
        .set_dfs_domain = dpd_set_domain,
        .add_pulse      = dpd_add_pulse,
+       .get_stats      = dpd_get_stats,
        .region         = NL80211_DFS_UNSET,
 };
 
index b09946fed9382bdd39a63f006f5696000b483e8b..9c752977eeff7b124c7fe23bc408447c10d48889 100644 (file)
 #include <linux/list.h>
 #include <linux/nl80211.h>
 
+/**
+ * struct ath_dfs_pool_stats - DFS Statistics for global pools
+ */
+struct ath_dfs_pool_stats {
+       u32 pool_reference;
+       u32 pulse_allocated;
+       u32 pulse_alloc_error;
+       u32 pulse_used;
+       u32 pseq_allocated;
+       u32 pseq_alloc_error;
+       u32 pseq_used;
+};
+
 /**
  * struct pulse_event - describing pulses reported by PHY
  * @ts: pulse time stamp in us
@@ -77,6 +90,7 @@ struct dfs_pattern_detector {
        bool (*add_pulse)(struct dfs_pattern_detector *dpd,
                          struct pulse_event *pe);
 
+       struct ath_dfs_pool_stats (*get_stats)(struct dfs_pattern_detector *dpd);
        enum nl80211_dfs_regions region;
        u8 num_radar_types;
        u64 last_pulse_ts;
index c718fc379a10d358dea7fd6ecef339d2d0f06742..17b5bf9fd6a1edc13ee31c3738ef50ad1405fead 100644 (file)
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 
-#include "ath9k.h"
+#include "../ath.h"
 #include "dfs_pattern_detector.h"
 #include "dfs_pri_detector.h"
-#include "dfs_debug.h"
+
+struct ath_dfs_pool_stats global_dfs_pool_stats = {};
+
+#define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++)
+#define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--)
 
 /**
  * struct pulse_elem - elements in pulse queue
index 723962d1abc68421a73b4c200cc6cb1bcf272be6..79f0fff4d1e662d065a4afb43ebde80d83eaa96c 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <linux/list.h>
 
+extern struct ath_dfs_pool_stats global_dfs_pool_stats;
+
 /**
  * struct pri_sequence - sequence of pulses matching one PRI
  * @head: list_head