提交 ddbfe860 编写于 作者: S Stanislaw Gruszka 提交者: Johannes Berg

mac80211: move sdata debugfs dir to vif

There is need create driver own per interface debugfs files. This is
currently done by drv_{add,remove}_interface_debugfs() callbacks. But it
is possible that after we remove interface from the driver (i.e.
on suspend) we call drv_remove_interface_debugfs() function. Fixing this
problem will require to add call drv_{add,remove}_interface_debugfs()
anytime we create and remove interface in mac80211. So it's better to
add debugfs dir dentry to vif structure to allow to create/remove
custom debugfs driver files on drv_{add,remove}_interface().
Signed-off-by: NStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 488b366a
...@@ -1067,6 +1067,9 @@ enum ieee80211_vif_flags { ...@@ -1067,6 +1067,9 @@ enum ieee80211_vif_flags {
* path needing to access it; even though the netdev carrier will always * path needing to access it; even though the netdev carrier will always
* be off when it is %NULL there can still be races and packets could be * be off when it is %NULL there can still be races and packets could be
* processed after it switches back to %NULL. * processed after it switches back to %NULL.
* @debugfs_dir: debugfs dentry, can be used by drivers to create own per
* interface debug files. Note that it will be NULL for the virtual
* monitor interface (if that is requested.)
* @drv_priv: data area for driver use, will always be aligned to * @drv_priv: data area for driver use, will always be aligned to
* sizeof(void *). * sizeof(void *).
*/ */
...@@ -1083,6 +1086,10 @@ struct ieee80211_vif { ...@@ -1083,6 +1086,10 @@ struct ieee80211_vif {
u32 driver_flags; u32 driver_flags;
#ifdef CONFIG_MAC80211_DEBUGFS
struct dentry *debugfs_dir;
#endif
/* must be last */ /* must be last */
u8 drv_priv[0] __aligned(sizeof(void *)); u8 drv_priv[0] __aligned(sizeof(void *));
}; };
......
...@@ -295,7 +295,7 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata) ...@@ -295,7 +295,7 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata)
char buf[50]; char buf[50];
struct ieee80211_key *key; struct ieee80211_key *key;
if (!sdata->debugfs.dir) if (!sdata->vif.debugfs_dir)
return; return;
lockdep_assert_held(&sdata->local->key_mtx); lockdep_assert_held(&sdata->local->key_mtx);
...@@ -311,7 +311,7 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata) ...@@ -311,7 +311,7 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata)
sprintf(buf, "../keys/%d", key->debugfs.cnt); sprintf(buf, "../keys/%d", key->debugfs.cnt);
sdata->debugfs.default_unicast_key = sdata->debugfs.default_unicast_key =
debugfs_create_symlink("default_unicast_key", debugfs_create_symlink("default_unicast_key",
sdata->debugfs.dir, buf); sdata->vif.debugfs_dir, buf);
} }
if (sdata->debugfs.default_multicast_key) { if (sdata->debugfs.default_multicast_key) {
...@@ -325,7 +325,7 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata) ...@@ -325,7 +325,7 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata)
sprintf(buf, "../keys/%d", key->debugfs.cnt); sprintf(buf, "../keys/%d", key->debugfs.cnt);
sdata->debugfs.default_multicast_key = sdata->debugfs.default_multicast_key =
debugfs_create_symlink("default_multicast_key", debugfs_create_symlink("default_multicast_key",
sdata->debugfs.dir, buf); sdata->vif.debugfs_dir, buf);
} }
} }
...@@ -334,7 +334,7 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) ...@@ -334,7 +334,7 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata)
char buf[50]; char buf[50];
struct ieee80211_key *key; struct ieee80211_key *key;
if (!sdata->debugfs.dir) if (!sdata->vif.debugfs_dir)
return; return;
key = key_mtx_dereference(sdata->local, key = key_mtx_dereference(sdata->local,
...@@ -343,7 +343,7 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) ...@@ -343,7 +343,7 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata)
sprintf(buf, "../keys/%d", key->debugfs.cnt); sprintf(buf, "../keys/%d", key->debugfs.cnt);
sdata->debugfs.default_mgmt_key = sdata->debugfs.default_mgmt_key =
debugfs_create_symlink("default_mgmt_key", debugfs_create_symlink("default_mgmt_key",
sdata->debugfs.dir, buf); sdata->vif.debugfs_dir, buf);
} else } else
ieee80211_debugfs_key_remove_mgmt_default(sdata); ieee80211_debugfs_key_remove_mgmt_default(sdata);
} }
......
...@@ -521,7 +521,7 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDuration, ...@@ -521,7 +521,7 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDuration,
#endif #endif
#define DEBUGFS_ADD_MODE(name, mode) \ #define DEBUGFS_ADD_MODE(name, mode) \
debugfs_create_file(#name, mode, sdata->debugfs.dir, \ debugfs_create_file(#name, mode, sdata->vif.debugfs_dir, \
sdata, &name##_ops); sdata, &name##_ops);
#define DEBUGFS_ADD(name) DEBUGFS_ADD_MODE(name, 0400) #define DEBUGFS_ADD(name) DEBUGFS_ADD_MODE(name, 0400)
...@@ -577,7 +577,7 @@ static void add_mesh_files(struct ieee80211_sub_if_data *sdata) ...@@ -577,7 +577,7 @@ static void add_mesh_files(struct ieee80211_sub_if_data *sdata)
static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) static void add_mesh_stats(struct ieee80211_sub_if_data *sdata)
{ {
struct dentry *dir = debugfs_create_dir("mesh_stats", struct dentry *dir = debugfs_create_dir("mesh_stats",
sdata->debugfs.dir); sdata->vif.debugfs_dir);
#define MESHSTATS_ADD(name)\ #define MESHSTATS_ADD(name)\
debugfs_create_file(#name, 0400, dir, sdata, &name##_ops); debugfs_create_file(#name, 0400, dir, sdata, &name##_ops);
...@@ -594,7 +594,7 @@ static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) ...@@ -594,7 +594,7 @@ static void add_mesh_stats(struct ieee80211_sub_if_data *sdata)
static void add_mesh_config(struct ieee80211_sub_if_data *sdata) static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
{ {
struct dentry *dir = debugfs_create_dir("mesh_config", struct dentry *dir = debugfs_create_dir("mesh_config",
sdata->debugfs.dir); sdata->vif.debugfs_dir);
#define MESHPARAMS_ADD(name) \ #define MESHPARAMS_ADD(name) \
debugfs_create_file(#name, 0600, dir, sdata, &name##_ops); debugfs_create_file(#name, 0600, dir, sdata, &name##_ops);
...@@ -631,7 +631,7 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata) ...@@ -631,7 +631,7 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
static void add_files(struct ieee80211_sub_if_data *sdata) static void add_files(struct ieee80211_sub_if_data *sdata)
{ {
if (!sdata->debugfs.dir) if (!sdata->vif.debugfs_dir)
return; return;
DEBUGFS_ADD(flags); DEBUGFS_ADD(flags);
...@@ -673,21 +673,21 @@ void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata) ...@@ -673,21 +673,21 @@ void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata)
char buf[10+IFNAMSIZ]; char buf[10+IFNAMSIZ];
sprintf(buf, "netdev:%s", sdata->name); sprintf(buf, "netdev:%s", sdata->name);
sdata->debugfs.dir = debugfs_create_dir(buf, sdata->vif.debugfs_dir = debugfs_create_dir(buf,
sdata->local->hw.wiphy->debugfsdir); sdata->local->hw.wiphy->debugfsdir);
if (sdata->debugfs.dir) if (sdata->vif.debugfs_dir)
sdata->debugfs.subdir_stations = debugfs_create_dir("stations", sdata->debugfs.subdir_stations = debugfs_create_dir("stations",
sdata->debugfs.dir); sdata->vif.debugfs_dir);
add_files(sdata); add_files(sdata);
} }
void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata)
{ {
if (!sdata->debugfs.dir) if (!sdata->vif.debugfs_dir)
return; return;
debugfs_remove_recursive(sdata->debugfs.dir); debugfs_remove_recursive(sdata->vif.debugfs_dir);
sdata->debugfs.dir = NULL; sdata->vif.debugfs_dir = NULL;
} }
void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata)
...@@ -695,7 +695,7 @@ void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) ...@@ -695,7 +695,7 @@ void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata)
struct dentry *dir; struct dentry *dir;
char buf[10 + IFNAMSIZ]; char buf[10 + IFNAMSIZ];
dir = sdata->debugfs.dir; dir = sdata->vif.debugfs_dir;
if (!dir) if (!dir)
return; return;
......
...@@ -560,7 +560,7 @@ void drv_add_interface_debugfs(struct ieee80211_local *local, ...@@ -560,7 +560,7 @@ void drv_add_interface_debugfs(struct ieee80211_local *local,
return; return;
local->ops->add_interface_debugfs(&local->hw, &sdata->vif, local->ops->add_interface_debugfs(&local->hw, &sdata->vif,
sdata->debugfs.dir); sdata->vif.debugfs_dir);
} }
static inline static inline
...@@ -575,7 +575,7 @@ void drv_remove_interface_debugfs(struct ieee80211_local *local, ...@@ -575,7 +575,7 @@ void drv_remove_interface_debugfs(struct ieee80211_local *local,
return; return;
local->ops->remove_interface_debugfs(&local->hw, &sdata->vif, local->ops->remove_interface_debugfs(&local->hw, &sdata->vif,
sdata->debugfs.dir); sdata->vif.debugfs_dir);
} }
#else #else
static inline static inline
......
...@@ -758,7 +758,6 @@ struct ieee80211_sub_if_data { ...@@ -758,7 +758,6 @@ struct ieee80211_sub_if_data {
#ifdef CONFIG_MAC80211_DEBUGFS #ifdef CONFIG_MAC80211_DEBUGFS
struct { struct {
struct dentry *dir;
struct dentry *subdir_stations; struct dentry *subdir_stations;
struct dentry *default_unicast_key; struct dentry *default_unicast_key;
struct dentry *default_multicast_key; struct dentry *default_multicast_key;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册