]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/mac80211/debugfs_netdev.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
[karo-tx-linux.git] / net / mac80211 / debugfs_netdev.c
index a32eeda04aa3f1bb980066f0183615c2acffd8df..e7af5227e322e08ea0e7ceaf507b357de9251026 100644 (file)
@@ -135,7 +135,7 @@ static ssize_t ieee80211_if_read_##name(struct file *file,          \
 static const struct file_operations name##_ops = {                     \
        .read = ieee80211_if_read_##name,                               \
        .write = (_write),                                              \
-       .open = mac80211_open_file_generic,                             \
+       .open = simple_open,                                            \
        .llseek = generic_file_llseek,                                  \
 }
 
@@ -424,6 +424,7 @@ static ssize_t ieee80211_if_parse_tsf(
        struct ieee80211_local *local = sdata->local;
        unsigned long long tsf;
        int ret;
+       int tsf_is_delta = 0;
 
        if (strncmp(buf, "reset", 5) == 0) {
                if (local->ops->reset_tsf) {
@@ -431,9 +432,20 @@ static ssize_t ieee80211_if_parse_tsf(
                        wiphy_info(local->hw.wiphy, "debugfs reset TSF\n");
                }
        } else {
+               if (buflen > 10 && buf[1] == '=') {
+                       if (buf[0] == '+')
+                               tsf_is_delta = 1;
+                       else if (buf[0] == '-')
+                               tsf_is_delta = -1;
+                       else
+                               return -EINVAL;
+                       buf += 2;
+               }
                ret = kstrtoull(buf, 10, &tsf);
                if (ret < 0)
                        return -EINVAL;
+               if (tsf_is_delta)
+                       tsf = drv_get_tsf(local, sdata) + tsf_is_delta * tsf;
                if (local->ops->set_tsf) {
                        drv_set_tsf(local, sdata, tsf);
                        wiphy_info(local->hw.wiphy,
@@ -499,26 +511,23 @@ IEEE80211_IF_FILE(dot11MeshForwarding, u.mesh.mshcfg.dot11MeshForwarding, DEC);
 IEEE80211_IF_FILE(rssi_threshold, u.mesh.mshcfg.rssi_threshold, DEC);
 #endif
 
-
-#define DEBUGFS_ADD(name) \
-       debugfs_create_file(#name, 0400, sdata->debugfs.dir, \
-                           sdata, &name##_ops);
-
 #define DEBUGFS_ADD_MODE(name, mode) \
        debugfs_create_file(#name, mode, sdata->debugfs.dir, \
                            sdata, &name##_ops);
 
-static void add_sta_files(struct ieee80211_sub_if_data *sdata)
+#define DEBUGFS_ADD(name) DEBUGFS_ADD_MODE(name, 0400)
+
+static void add_common_files(struct ieee80211_sub_if_data *sdata)
 {
        DEBUGFS_ADD(drop_unencrypted);
-       DEBUGFS_ADD(flags);
-       DEBUGFS_ADD(state);
-       DEBUGFS_ADD(channel_type);
        DEBUGFS_ADD(rc_rateidx_mask_2ghz);
        DEBUGFS_ADD(rc_rateidx_mask_5ghz);
        DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
        DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz);
+}
 
+static void add_sta_files(struct ieee80211_sub_if_data *sdata)
+{
        DEBUGFS_ADD(bssid);
        DEBUGFS_ADD(aid);
        DEBUGFS_ADD(last_beacon);
@@ -531,15 +540,6 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata)
 
 static void add_ap_files(struct ieee80211_sub_if_data *sdata)
 {
-       DEBUGFS_ADD(drop_unencrypted);
-       DEBUGFS_ADD(flags);
-       DEBUGFS_ADD(state);
-       DEBUGFS_ADD(channel_type);
-       DEBUGFS_ADD(rc_rateidx_mask_2ghz);
-       DEBUGFS_ADD(rc_rateidx_mask_5ghz);
-       DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
-       DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz);
-
        DEBUGFS_ADD(num_sta_authorized);
        DEBUGFS_ADD(num_sta_ps);
        DEBUGFS_ADD(dtim_count);
@@ -549,48 +549,14 @@ static void add_ap_files(struct ieee80211_sub_if_data *sdata)
 
 static void add_ibss_files(struct ieee80211_sub_if_data *sdata)
 {
-       DEBUGFS_ADD(channel_type);
-       DEBUGFS_ADD(rc_rateidx_mask_2ghz);
-       DEBUGFS_ADD(rc_rateidx_mask_5ghz);
-       DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
-       DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz);
-
        DEBUGFS_ADD_MODE(tsf, 0600);
 }
 
 static void add_wds_files(struct ieee80211_sub_if_data *sdata)
 {
-       DEBUGFS_ADD(drop_unencrypted);
-       DEBUGFS_ADD(flags);
-       DEBUGFS_ADD(state);
-       DEBUGFS_ADD(channel_type);
-       DEBUGFS_ADD(rc_rateidx_mask_2ghz);
-       DEBUGFS_ADD(rc_rateidx_mask_5ghz);
-       DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
-       DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz);
-
        DEBUGFS_ADD(peer);
 }
 
-static void add_vlan_files(struct ieee80211_sub_if_data *sdata)
-{
-       DEBUGFS_ADD(drop_unencrypted);
-       DEBUGFS_ADD(flags);
-       DEBUGFS_ADD(state);
-       DEBUGFS_ADD(channel_type);
-       DEBUGFS_ADD(rc_rateidx_mask_2ghz);
-       DEBUGFS_ADD(rc_rateidx_mask_5ghz);
-       DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
-       DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz);
-}
-
-static void add_monitor_files(struct ieee80211_sub_if_data *sdata)
-{
-       DEBUGFS_ADD(flags);
-       DEBUGFS_ADD(state);
-       DEBUGFS_ADD(channel_type);
-}
-
 #ifdef CONFIG_MAC80211_MESH
 
 static void add_mesh_files(struct ieee80211_sub_if_data *sdata)
@@ -651,6 +617,13 @@ static void add_files(struct ieee80211_sub_if_data *sdata)
        if (!sdata->debugfs.dir)
                return;
 
+       DEBUGFS_ADD(flags);
+       DEBUGFS_ADD(state);
+       DEBUGFS_ADD(channel_type);
+
+       if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
+               add_common_files(sdata);
+
        switch (sdata->vif.type) {
        case NL80211_IFTYPE_MESH_POINT:
 #ifdef CONFIG_MAC80211_MESH
@@ -671,12 +644,6 @@ static void add_files(struct ieee80211_sub_if_data *sdata)
        case NL80211_IFTYPE_WDS:
                add_wds_files(sdata);
                break;
-       case NL80211_IFTYPE_MONITOR:
-               add_monitor_files(sdata);
-               break;
-       case NL80211_IFTYPE_AP_VLAN:
-               add_vlan_files(sdata);
-               break;
        default:
                break;
        }